Skip to content
Snippets Groups Projects

[Simd] Introduce broadcast<V>(s) function.

Merged Jö Fahlke requested to merge simd-broadcast-func into test-vc-again

Improve syntax for initializing SIMD vectors: broadcast initialization.

Basically the incantation to broadcast-initialize a SIMD vector is:

V vec(Simd::Scalar<V>(42));

Brace initialization will often not work, and initialization directly by an int will often not work for vectors of floating-point types.

This MR introduces a Simd::broadcast<V>() function, which allows for broadcast initialization like this:

auto vec = Simd::broadcast<V>(42);

The type of the broadcast value does not matter here, as long as it can be explicitly cast to Simd::Scalar<V>. In this sense broadcast<V>() is an explicit-cast function.

Edited by Jö Fahlke

Merge request reports

Pipeline #10027 passed with warnings

Pipeline passed with warnings for e90c77da on simd-broadcast-func

Approval is optional

Merged by Jö FahlkeJö Fahlke 6 years ago (Jun 25, 2018 2:33pm UTC)

Merge details

  • Changes merged into master with 18ee88af.
  • Deleted the source branch.

Pipeline #10028 passed with warnings

Pipeline passed with warnings for 18ee88af on test-vc-again

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Please register or sign in to reply
Loading