On Friday, 9 October 2015 at 02:44:19 UTC, Timothee Cour wrote:
also, workarounds involving:
iota(0,256).map!(a=>cast(ubyte)a)
are neither pleasant nor efficient
There's no difference in efficiency since that's how it'd
probably be done on the low level anyway (assuming the compiler
inlines it at least).
I suppose it could also be written something like
xor al, al;
again:
// stuff here
inc al;
jnc again;
But I doubt there'd be a real performance difference between that
and the int compare+cast version anyway.
I think the way you did it there is one of the better options. If
you don't like how it looks, just wrap it in a little function so
you only have to look at it once.
If you want it in phobos, you could submit the function for there
too in a pull request.