Path: utzoo!utgpu!news-server.csri.toronto.edu!torsqnt!tmsoft!masnet!canremote!john.russell From: john.russell@canremote.uucp (JOHN RUSSELL) Newsgroups: comp.lang.c Subject: IsUnsigned function? Message-ID: <15303b1aa0bf26a8c5d4@canremote.uucp> Date: 21 Jul 90 19:15:00 GMT Organization: Canada Remote Systems Limited, Mississauga, ON, Canada Lines: 18 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