summaryrefslogtreecommitdiff
path: root/support/regression/tests/smallc.c
blob: 8ade7a949a2df8c10af63e6e93aed1081ae350f0 (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
38
/*
	smallc.c

	Test support for __smallc for Small-C-compatible calling convention
*/
#include <testfwk.h>
#include <stdlib.h>

unsigned char f1(unsigned char c) __smallc
{
	return c + 1;
}

unsigned int f2(unsigned int c) __smallc
{
	return c + 1;
}

unsigned char s1(unsigned char c, unsigned char d) __smallc
{
	return c - d;
}

unsigned int s2(unsigned int c, unsigned int d) __smallc
{
	return c - d;
}

void
testSmallC(void)
{
  ASSERT (f1 (23) == 24);
  ASSERT (f2 (23) == 24);

  ASSERT (s1 (42, 23) == 19);
  ASSERT (s2 (42, 23) == 19);
}