IsUnsigned function?

JOHN RUSSELL john.russell at canremote.uucp
Sun Jul 22 05:15:00 AEST 1990


None of the answers so fa{ has addressed the question of "space 
efficient".  Any solution that uses "if" stands a chance of generating 
branch instructions.  Any solution that explicitly returns 0 or 1 will 
generate a "clear" instruction, and maybe a "move" instruction with a 16
or 32-bit operand.

The question might also have been checking for knowledge of a particular
chip instruction set, eg. on 68K a moveq.l #1 instruction allows you to 
explicitly return a 1 without wasting 32 bits to hold the operand. 
 
I won't post my solution  (after all, Microsoft is presumably still
asking this question), but is compiles to 3 instructions plus function
linking stuff; one of the instructions has a 16-bit operand, the others
are register-to-register.  (This is on a 68K without any optimization.)
 
John
---
 * Via ProDoor 3.1R 



More information about the Comp.lang.c mailing list