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

python - How to add an model instance to a django queryset? -

Using Android Volley to post an array to PHP -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -