Mercurial > hg > CbC > old > device
diff test/bitfield.c @ 338:7fe7ce0a791f bit-field-done
bit-field done for IA32, PowerPC, MIPS.
bit-field assop.
No bit-field global init.
author | kono |
---|---|
date | Fri, 25 Jun 2004 14:30:43 +0900 |
parents | d488b72254fb |
children | 5ac17fa9d7e0 |
line wrap: on
line diff
--- a/test/bitfield.c Fri Jun 25 05:37:09 2004 +0900 +++ b/test/bitfield.c Fri Jun 25 14:30:43 2004 +0900 @@ -17,6 +17,7 @@ unsigned long g:1; unsigned long :1; unsigned long pp:2; + long long lpn:40; } pte; struct { unsigned char v:1; @@ -188,6 +189,8 @@ printf("%d %d %d\n",a.pte.pp,g.pte.pp,p->pte.pp); main2(); main5(); + main3(); + main4(); return 0; } @@ -326,25 +329,150 @@ main3( int a ) { // int b:9; // nor local variable - int b; + int b,i; + i = 7; - g.pte.rpn--; - g.pte.rpn++; - --g.pte.rpn; - ++g.pte.rpn; - g.pte.rpn += 3; - g.pte.rpn -= 3; - g.pte.rpn *= 3; - g.pte.rpn /= 3; - g.pte.rpn %= 3; - g.pte.rpn |= 3; - g.pte.rpn &= 3; - g.pte.rpn ^= 3; + b = g.pte.rpn = -333; + printf("main3-0: %d\n",b); + b = g.pte.rpn--; + printf("main3-1: %d\n",b); + b = g.pte.rpn++; + printf("main3-2: %d\n",b); + b = --g.pte.rpn; + printf("main3-3: %d\n",b); + b = ++g.pte.rpn; + printf("main3-4: %d\n",b); + b = (g.pte.rpn += 3); + printf("main3-5: %d\n",b); + b = (g.pte.rpn -= 3); + printf("main3-6: %d\n",b); + b = (g.pte.rpn *= 3); + printf("main3-7: %d\n",b); + b = (g.pte.rpn /= 3); + printf("main3-8: %d\n",b); + b = (g.pte.rpn %= 3); + printf("main3-9: %d\n",b); + b = (g.pte.rpn |= 3); + printf("main3-10: %d\n",b); + b = (g.pte.rpn &= 3); + printf("main3-12: %d\n",b); + b = (g.pte.rpn ^= 3); + printf("main3-13: %d\n",b); + b = (g.pte.rpn <<= 3); + printf("main3-14: %d\n",b); + b = (g.pte.rpn >>= 3); + printf("main3-15: %d\n",b); + + g.pte.rpn = -333; + printf("main3-16: %d\n",b); + b = g.pte.rpn--; + printf("main3-17: %d\n",b); + b = g.pte.rpn++; + printf("main3-18: %d\n",b); + b = --g.pte.rpn; + printf("main3-19: %d\n",b); + b = ++g.pte.rpn; + printf("main3-20: %d\n",b); + b = (g.pte.rpn += i); + printf("main3-21: %d\n",b); + b = (g.pte.rpn -= i); + printf("main3-22: %d\n",b); + b = (g.pte.rpn *= i); + printf("main3-23: %d\n",b); + b = (g.pte.rpn /= i); + printf("main3-24: %d\n",b); + b = (g.pte.rpn %= i); + printf("main3-25: %d\n",b); + b = (g.pte.rpn |= i); + printf("main3-26: %d\n",b); + b = (g.pte.rpn &= i); + printf("main3-27: %d\n",b); + b = (g.pte.rpn ^= i); + printf("main3-28: %d\n",b); + b = (g.pte.rpn <<= i); + printf("main3-29: %d\n",b); + b = (g.pte.rpn >>= i); + printf("main3-30: %d\n",b); return --b; } +main4( int a ) +{ + // int b:9; // nor local variable + int b,i; + PTE *pg = &g; + + i = 7; + + + pg->pte.rpn = -333; + printf("main4-0: %d\n",b); + b = pg->pte.rpn--; + printf("main4-1: %d\n",b); + b = pg->pte.rpn++; + printf("main4-2: %d\n",b); + b = --pg->pte.rpn; + printf("main4-3: %d\n",b); + b = ++pg->pte.rpn; + printf("main4-4: %d\n",b); + b = (pg->pte.rpn += 3); + printf("main4-5: %d\n",b); + b = (pg->pte.rpn -= 3); + printf("main4-6: %d\n",b); + b = (pg->pte.rpn *= 3); + printf("main4-7: %d\n",b); + b = (pg->pte.rpn /= 3); + printf("main4-8: %d\n",b); + b = (pg->pte.rpn %= 3); + printf("main4-9: %d\n",b); + b = (pg->pte.rpn |= 3); + printf("main4-10: %d\n",b); + b = (pg->pte.rpn &= 3); + printf("main4-12: %d\n",b); + b = (pg->pte.rpn ^= 3); + printf("main4-13: %d\n",b); + b = (pg->pte.rpn <<= 3); + printf("main4-14: %d\n",b); + b = (pg->pte.rpn >>= 3); + printf("main4-15: %d\n",b); + + pg->pte.rpn = -333; + printf("main4-16: %d\n",b); + b = pg->pte.rpn--; + printf("main4-17: %d\n",b); + b = pg->pte.rpn++; + printf("main4-18: %d\n",b); + b = --pg->pte.rpn; + printf("main4-19: %d\n",b); + b = ++pg->pte.rpn; + printf("main4-20: %d\n",b); + b = (pg->pte.rpn += i); + printf("main4-21: %d\n",b); + b = (pg->pte.rpn -= i); + printf("main4-22: %d\n",b); + b = (pg->pte.rpn *= i); + printf("main4-23: %d\n",b); + b = (pg->pte.rpn /= i); + printf("main4-24: %d\n",b); + b = (pg->pte.rpn %= i); + printf("main4-25: %d\n",b); + b = (pg->pte.rpn |= i); + printf("main4-26: %d\n",b); + b = (pg->pte.rpn &= i); + printf("main4-27: %d\n",b); + b = (pg->pte.rpn ^= i); + printf("main4-28: %d\n",b); + b = (pg->pte.rpn <<= i); + printf("main4-29: %d\n",b); + b = (pg->pte.rpn >>= i); + printf("main4-30: %d\n",b); + + return --b; +} + + @@ -537,3 +665,75 @@ } +main3l( int a ) +{ + // int b:9; // nor local variable + long long b,i; + i = 7; + + + g.pte.lpn = -333; + printf("main3l-0: %d\n",b); + b = g.pte.lpn--; + printf("main3l-1: %d\n",b); + b = g.pte.lpn++; + printf("main3l-2: %d\n",b); + b = --g.pte.lpn; + printf("main3l-3: %d\n",b); + b = ++g.pte.lpn; + printf("main3l-4: %d\n",b); + b = (g.pte.lpn += 3); + printf("main3l-5: %d\n",b); + b = (g.pte.lpn -= 3); + printf("main3l-6: %d\n",b); + b = (g.pte.lpn *= 3); + printf("main3l-7: %d\n",b); + b = (g.pte.lpn /= 3); + printf("main3l-8: %d\n",b); + b = (g.pte.lpn %= 3); + printf("main3l-9: %d\n",b); + b = (g.pte.lpn |= 3); + printf("main3l-10: %d\n",b); + b = (g.pte.lpn &= 3); + printf("main3l-12: %d\n",b); + b = (g.pte.lpn ^= 3); + printf("main3l-13: %d\n",b); + b = (g.pte.lpn <<= 3); + printf("main3l-14: %d\n",b); + b = (g.pte.lpn >>= 3); + printf("main3l-15: %d\n",b); + + g.pte.lpn = -333; + printf("main3l-16: %d\n",b); + b = g.pte.lpn--; + printf("main3l-17: %d\n",b); + b = g.pte.lpn++; + printf("main3l-18: %d\n",b); + b = --g.pte.lpn; + printf("main3l-19: %d\n",b); + b = ++g.pte.lpn; + printf("main3l-20: %d\n",b); + b = (g.pte.lpn += i); + printf("main3l-21: %d\n",b); + b = (g.pte.lpn -= i); + printf("main3l-22: %d\n",b); + b = (g.pte.lpn *= i); + printf("main3l-23: %d\n",b); + b = (g.pte.lpn /= i); + printf("main3l-24: %d\n",b); + b = (g.pte.lpn %= i); + printf("main3l-25: %d\n",b); + b = (g.pte.lpn |= i); + printf("main3l-26: %d\n",b); + b = (g.pte.lpn &= i); + printf("main3l-27: %d\n",b); + b = (g.pte.lpn ^= i); + printf("main3l-28: %d\n",b); + b = (g.pte.lpn <<= i); + printf("main3l-29: %d\n",b); + b = (g.pte.lpn >>= i); + printf("main3l-30: %d\n",b); + + return --b; +} +