@johnregehr @ch3root @spun_off They're all incorrect. ~7u is well-defined truncated to width of unsigned. ~7 assumes 2s complement.
-
-
Replying to @RichFelker
@RichFelker@ch3root @spun_off which non-2's complement platforms does musl support?3 replies 0 retweets 0 likes -
Replying to @johnregehr
@johnregehr@RichFelker@ch3root @spun_off The C standard guarantees pointer -> [u]intptr_t -> pointer round trips. However...1 reply 0 retweets 0 likes -
Replying to @BRIAN_____
@johnregehr@RichFelker@ch3root @spun_off ...it doesn't guarantee anything if you do any math on the [u]intptr_t value in the middle.2 replies 0 retweets 1 like -
Replying to @BRIAN_____
@johnregehr@RichFelker@ch3root @spun_off Maybe: (char *)(((uintptr_t)(p + 7) & ((uintptr_t)~UINTMAX_C(7)) is better.1 reply 0 retweets 0 likes -
Replying to @BRIAN_____
@johnregehr@RichFelker@ch3root @spun_off Prerequisite: p points to an object that is at least 8 octets long.1 reply 0 retweets 0 likes -
Replying to @BRIAN_____
@johnregehr@RichFelker@ch3root @spun_off But, the `&` still ruins things, if we're being pedantic. (And if we aren't, why are we here?)1 reply 0 retweets 0 likes -
Replying to @BRIAN_____
@BRIAN_____@johnregehr@RichFelker@ch3root @spun_off There's always `while((uintptr_t)p % 8) { ++p; } return p;`1 reply 0 retweets 1 like -
Replying to @sevenps
@sevenps@johnregehr@RichFelker@ch3root @spun_off Isn't `%` on `uintptr_t` values undefined? e.g. if ptr <-> int cast requres ROTR/ROTL.2 replies 0 retweets 0 likes -
Replying to @BRIAN_____
@BRIAN_____@sevenps@johnregehr@ch3root @spun_off % is always defined on uint types, but any correspondence to addr arch is impl-defined.1 reply 0 retweets 1 like
@BRIAN_____ @sevenps @johnregehr @ch3root @spun_off If the impl-def'd (i.e. ABI-def'd) conv to uintptr_t is flat, % does what you want.
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.