aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/tests/fake/fake.h
blob: 989a361a67b2ff5018974ade2483446630afe6c9 (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
31
32
33
34
35
36
37
#ifndef FAKE_H_
#define FAKE_H_

#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>

#include "int24.h"


typedef Int24 __int24;
typedef UInt24 __uint24;


static inline char *utoa(unsigned int val, char *s, int radix)
{
	if (radix == 16) {
		sprintf(s, "%X", val);
	} else {
		fprintf(stderr, "utoa: Unsupported radix %d\n", radix);
		abort();
	}
	return s;
}

static inline char *ltoa(long val, char *s, int radix)
{
	if (radix == 10) {
		sprintf(s, "%ld", val);
	} else {
		fprintf(stderr, "ltoa: Unsupported radix %d\n", radix);
		abort();
	}
	return s;
}

#endif /* FAKE_H_ */
bues.ch cgit interface