aboutsummaryrefslogtreecommitdiff
path: root/src/test.c
blob: 77ae5fbe7fa67c8b3b0540e314ac4ff98c8c4851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <stdlib.h>
#include "utils.h"
#include "arith.h"

void ops_test (void);

void
print_number (u32 num)
{
  char sign = num & MASK_NEG ? '-' : ' ';
  num &= ~MASK_FLAGS;
  u8 offset;
  for (offset = 7*BPD; offset; offset -= BPD) {
    if (num >> offset & DIGIT_MASK)
      break;
    putchar (' ');
  }
  printf ("%c", sign);
  for (; offset; offset -= BPD)
    printf ("%c", I2C (num >> offset & DIGIT_MASK));
  printf ("%c\n", I2C (num & DIGIT_MASK));
}

int
main (void)
{
  ops_test ();

  return EXIT_SUCCESS;
}