Home

About

Advanced Search

Browse by Discipline

Scientific Societies

E-print Alerts

Add E-prints

E-print Network
FAQHELPSITE MAPCONTACT US


  Advanced Search  

 
Binghamton University Integer C Puzzles
 

Summary: 1
Binghamton University
Integer C Puzzles
· x < 0 ((x*2) < 0) no (overflow)
· ux >= 0 yes (casting to unsigned)
· x & 7 == 7 (x<<30) < 0 (yes)
· ux > -1 (no, casting to unsigned)
· x > y -x < -y (no, Tmin)
· x * x >= 0 (no overflow)
· x > 0 && y > 0 x + y > 0 (no overflow)
· x >= 0 -x <= 0 (yes)
· x <= 0 -x >= 0 (no, Tmin)
· (x|-x)>>31 == -1 (no, zero)
· ux >> 3 == ux/8 (yes)
· x >> 3 == x/8 (no, sign extend means no zero)
· x & (x-1) != 0 (no, power of two numbers fail)
int x = foo();
int y = bar();
unsigned ux = x;
unsigned uy = y;

  

Source: Abu-Ghazaleh, Nael B. - Department of Computer Science, State University of New York at Binghamton

 

Collections: Computer Technologies and Information Sciences