Also, perversely, there are some things that are *really* awkward to write in C-ish langs without invoking UB, but trivial in asm.
-
-
rotl
2 replies 0 retweets 3 likes -
Yup. A few of the many others: - Saturating convert float -> int. - Aligned load/store that accesses outside the edge of a buffer (but, because aligned, is safe on the targeted arch). - Popcount / CLZ / CTZ (ok, these have gcc builtins). ...
3 replies 0 retweets 8 likes -
-
Replying to @FioraAeterna @stephentyrone and
That's what *(unsigned char*)&buf is for
2 replies 0 retweets 0 likes -
Replying to @myrrlyn @stephentyrone and
what if you want loads larger than 8-bit
2 replies 0 retweets 3 likes -
Replying to @FioraAeterna @myrrlyn and
Compiler should be able to do load & store merging, esp. if you use memcpy to do the unaligned load.
1 reply 0 retweets 2 likes -
Replying to @RichFelker @myrrlyn and
yeah, you can use memcpy for loads. it's just awkward as hell
4 replies 0 retweets 3 likes -
Replying to @FioraAeterna @RichFelker and
(a) is memmove okay with this as well; I can never keep track of what those do differently other than overlap (b) still serious, while byte-unaligned is moderately tolerable, is there a reasonable solution for bit-unaligned txfer
2 replies 0 retweets 0 likes -
Replying to @myrrlyn @FioraAeterna and
For (a), to make the load-combining optimization, dest should be a local temp whose address doesn't leak. So memmove makes no sense.
1 reply 0 retweets 0 likes
It probably doesn't hurt to use memmove though since the compiler can see that args can't alias & replace it with memcpy.
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.