Repository navigation
Replies: 1 comment
|
Note that the |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
What problem does this solve or what need does it fill?
div_euclidandrem_euclidconjointly on a type, we have to call both functions seperately. When looking at rust's standard library, there's a function specifically for this use case, making it more ergonomic and (maybe?) making certain optimisations possible.div_euclidandrem_euclidtake as operand another vector of the same type. This means we often write code like:v.div_euclid(IVec3::splat(value)). This is a little convoluted, and makes it unclear whether or not the compiler will duplicate memory. On low optimization levels (opt-level=0, debug builds), splat does not seem to inline, and I could not verify on opt-level=3 whether data is duplicated, although it apeared not to.Describe the solution you'd like
Define functions
div_rem_euclidfor common types.Have these functions work like the standard library using a trait, that would allow for variable operands. For example:
All reactions