Exemplo n.º 1
0
void doALUOperation()
{
    switch (aluOperation) {
        case 0: add(); break;
        case 1: bitwise(destination | source); break;
        case 2: source += cf() ? 1 : 0; add(); break;
        case 3: source += cf() ? 1 : 0; sub(); break;
        case 4: test(destination, source); break;
        case 5:
        case 7: sub(); break;
        case 6: bitwise(destination ^ source); break;
    }
}
Exemplo n.º 2
0
main()
{
  int y;
  void bitwise();

  for (y = 0; y<20; ++y)
    bitwise(y);

  y = 10;
  printf("%d is y\n",y);
  y = ~y;
  printf("\n");
  printf("%d is y\n",y);
  bitwise(y);
}
Exemplo n.º 3
0
main(int argc, char** argv) {
//    testIsDecimal();
//    testPower();
//    testCharToInt();
//    testParseInt();
    if (argc >= 3) {
        bitwise(parseInt(argv[1]), parseInt(argv[2]));
    } else {
        printf("Usage: ./bitwise <n> <b>\n");
    }
}
Exemplo n.º 4
0
void test(Word d, Word s)
{
    destination = d;
    source = s;
    bitwise(destination & source);
}