boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

003-compound.c (731B)


      1 /* tests/cc-e2e/03-compound.c — compound-assignment operators.
      2  * Split from 01-kitchen-sink. */
      3 
      4 int test_compound(void) {
      5     int x = 10;
      6     x += 5;                         /* 15 */
      7     x -= 3;                         /* 12 */
      8     x *= 2;                         /* 24 */
      9     x /= 4;                         /* 6  */
     10     x %= 4;                         /* 2  */
     11     x <<= 3;                        /* 16 */
     12     x >>= 1;                        /* 8  */
     13     x &= 12;                        /* 8  */
     14     x |= 1;                         /* 9  */
     15     x ^= 6;                         /* 15 */
     16     return x;                       /* 15 */
     17 }
     18 
     19 int main(int argc, char **argv) {
     20     if (test_compound() != 15) return 1;
     21     return 0;
     22 }