Explorar el Código

finish quiz4

master
吴冕志 hace 1 año
padre
commit
0a1d0cd33d
Se han modificado 1 ficheros con 9 adiciones y 1 borrados
  1. +9
    -1
      lab2/datalab-handout/bits.c

+ 9
- 1
lab2/datalab-handout/bits.c Ver fichero

@ -188,7 +188,15 @@ int isTmax(int x) {
* Rating: 2
*/
int allOddBits(int x) {
return 2;
int base = 42;
int neg = 1 << 7;
int unit8 = base + neg;
int unit16 = (unit8 << 8) + unit8;
int unit32 = (unit16 << 16) + unit16;
int shouldunit32 = x & unit32;
int allzero = shouldunit32^unit32;
int res = !allzero;
return res;
}
/*
* negate - return -x

Cargando…
Cancelar
Guardar