How to detect encodings on signed integers in C? -



How to detect encodings on signed integers in C? -

the iso c standard allows 3 encoding methods signed integers: two's complement, one's complement , sign/magnitude.

what's efficient or way observe encoding @ runtime (or other time if there's improve solution)? want know can optimise bignum library different possibilities.

i plan on calculating , storing in variable each time programme runs doesn't have blindingly fast - i'm assuming encoding won't alter during programme run :-)

you have check low order bits of constant -1 -1 & 3. evaluates

for sign , magnitude, for one's complement and for two's complement.

this should possible in preprocessor look within #if #else constructs.

c signed twos-complement ones-complement

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -