lfpfunc.c revision 289999
1284990Scy#include "config.h"
2284990Scy
3284990Scy#include "ntp_stdlib.h"
4284990Scy#include "ntp_fp.h"
5284990Scy
6284990Scy#include "unity.h"
7284990Scy
8284990Scy#include <float.h>
9284990Scy#include <math.h>
10284990Scy
11284990Scy
12289999Sglebius/* replaced TEST_ASSERT_EQUAL_MEMORY(&a, &b, sizeof(a)) with TEST_ASSERT_EQUAL_l_fp(a, b).
13289999Sglebius   It's safer this way, because structs can be compared even if they aren't initiated
14289999Sglebius   with memset (due to padding bytes).
15289999Sglebius*/
16284990Scy#define TEST_ASSERT_EQUAL_l_fp(a, b) { \
17284990Scy    TEST_ASSERT_EQUAL_MESSAGE(a.l_i, b.l_i, "Field l_i"); \
18284990Scy    TEST_ASSERT_EQUAL_UINT_MESSAGE(a.l_uf, b.l_uf, "Field l_uf");	\
19284990Scy}
20284990Scy
21284990Scy
22284990Scy
23289999Sglebiustypedef int bool; // typedef enum { FALSE, TRUE } boolean; -> can't use this because TRUE and FALSE are already defined
24284990Scy
25284990Scy
26289999Sglebiustypedef struct  {
27289999Sglebius	uint32_t h, l;
28289999Sglebius} lfp_hl;
29284990Scy
30284990Scy
31289999Sglebiusint l_fp_scmp(const l_fp first, const l_fp second);
32289999Sglebiusint l_fp_ucmp(const l_fp first, l_fp second );
33289999Sglebiusl_fp l_fp_init(int32 i, u_int32 f);
34289999Sglebiusl_fp l_fp_add(const l_fp first, const l_fp second);
35289999Sglebiusl_fp l_fp_subtract(const l_fp first, const l_fp second);
36289999Sglebiusl_fp l_fp_negate(const l_fp first);
37289999Sglebiusl_fp l_fp_abs(const l_fp first);
38289999Sglebiusint l_fp_signum(const l_fp first);
39289999Sglebiusdouble l_fp_convert_to_double(const l_fp first);
40289999Sglebiusl_fp l_fp_init_from_double( double rhs);
41289999Sglebiusvoid l_fp_swap(l_fp * first, l_fp *second);
42289999Sglebiusbool l_isgt(const l_fp first, const l_fp second);
43289999Sglebiusbool l_isgtu(const l_fp first, const l_fp second);
44289999Sglebiusbool l_ishis(const l_fp first, const l_fp second);
45289999Sglebiusbool l_isgeq(const l_fp first, const l_fp second);
46289999Sglebiusbool l_isequ(const l_fp first, const l_fp second);
47289999Sglebiusdouble eps(double d);
48284990Scy
49284990Scy
50289999Sglebiusvoid test_AdditionLR(void);
51289999Sglebiusvoid test_AdditionRL(void);
52289999Sglebiusvoid test_SubtractionLR(void);
53289999Sglebiusvoid test_SubtractionRL(void);
54289999Sglebiusvoid test_Negation(void);
55289999Sglebiusvoid test_Absolute(void);
56289999Sglebiusvoid test_FDF_RoundTrip(void);
57289999Sglebiusvoid test_SignedRelOps(void);
58289999Sglebiusvoid test_UnsignedRelOps(void);
59284990Scy
60284990Scy
61284990Scy
62289999Sglebiusstatic int cmp_work(u_int32 a[3], u_int32 b[3]);
63284990Scy
64284990Scy//----------------------------------------------------------------------
65284990Scy// reference comparision
66284990Scy// This is implementad as a full signed MP-subtract in 3 limbs, where
67284990Scy// the operands are zero or sign extended before the subtraction is
68284990Scy// executed.
69284990Scy//----------------------------------------------------------------------
70289999Sglebius
71289999Sglebiusint
72289999Sglebiusl_fp_scmp(const l_fp first, const l_fp second)
73284990Scy{
74284990Scy	u_int32 a[3], b[3];
75284990Scy
76284990Scy	const l_fp op1 = first;
77284990Scy	const l_fp op2 = second;
78284990Scy
79284990Scy	a[0] = op1.l_uf; a[1] = op1.l_ui; a[2] = 0;
80284990Scy	b[0] = op2.l_uf; b[1] = op2.l_ui; b[2] = 0;
81284990Scy
82284990Scy	a[2] -= (op1.l_i < 0);
83284990Scy	b[2] -= (op2.l_i < 0);
84284990Scy
85284990Scy	return cmp_work(a,b);
86284990Scy}
87284990Scy
88289999Sglebiusint
89289999Sglebiusl_fp_ucmp(const l_fp first, l_fp second )
90284990Scy{
91284990Scy	u_int32 a[3], b[3];
92284990Scy	const l_fp op1 = first;
93284990Scy	const l_fp op2 = second;
94284990Scy
95284990Scy	a[0] = op1.l_uf; a[1] = op1.l_ui; a[2] = 0;
96284990Scy	b[0] = op2.l_uf; b[1] = op2.l_ui; b[2] = 0;
97284990Scy
98284990Scy	return cmp_work(a,b);
99284990Scy}
100284990Scy
101289999Sglebius// maybe rename it to lf_cmp_work
102289999Sglebiusint
103289999Sglebiuscmp_work(u_int32 a[3], u_int32 b[3])
104284990Scy{
105284990Scy	u_int32 cy, idx, tmp;
106284990Scy	for (cy = idx = 0; idx < 3; ++idx) {
107284990Scy		tmp = a[idx]; cy  = (a[idx] -=   cy  ) > tmp;
108284990Scy		tmp = a[idx]; cy |= (a[idx] -= b[idx]) > tmp;
109284990Scy	}
110284990Scy	if (a[2])
111284990Scy		return -1;
112284990Scy	return a[0] || a[1];
113284990Scy}
114284990Scy
115284990Scy
116284990Scy//----------------------------------------------------------------------
117284990Scy// imlementation of the LFP stuff
118284990Scy// This should be easy enough...
119284990Scy//----------------------------------------------------------------------
120284990Scy
121289999Sglebiusl_fp
122289999Sglebiusl_fp_init(int32 i, u_int32 f)
123284990Scy{
124284990Scy	l_fp temp;
125284990Scy	temp.l_i  = i;
126284990Scy	temp.l_uf = f;
127284990Scy
128284990Scy	return temp;
129284990Scy}
130284990Scy
131289999Sglebiusl_fp
132289999Sglebiusl_fp_add(const l_fp first, const l_fp second)
133284990Scy{
134289999Sglebius	l_fp temp = first;
135284990Scy	L_ADD(&temp, &second);
136289999Sglebius
137284990Scy	return temp;
138284990Scy}
139284990Scy
140289999Sglebiusl_fp
141289999Sglebiusl_fp_subtract(const l_fp first, const l_fp second)
142284990Scy{
143289999Sglebius	l_fp temp = first;
144284990Scy	L_SUB(&temp, &second);
145284990Scy
146284990Scy	return temp;
147284990Scy}
148284990Scy
149289999Sglebiusl_fp
150289999Sglebiusl_fp_negate(const l_fp first)
151284990Scy{
152289999Sglebius	l_fp temp = first;
153284990Scy	L_NEG(&temp);
154284990Scy
155284990Scy	return temp;
156284990Scy}
157284990Scy
158289999Sglebiusl_fp
159289999Sglebiusl_fp_abs(const l_fp first)
160284990Scy{
161284990Scy	l_fp temp = first;
162284990Scy	if (L_ISNEG(&temp))
163284990Scy		L_NEG(&temp);
164284990Scy	return temp;
165284990Scy}
166284990Scy
167289999Sglebiusint
168289999Sglebiusl_fp_signum(const l_fp first)
169284990Scy{
170284990Scy	if (first.l_ui & 0x80000000u)
171284990Scy		return -1;
172284990Scy	return (first.l_ui || first.l_uf);
173284990Scy}
174284990Scy
175289999Sglebiusdouble
176289999Sglebiusl_fp_convert_to_double(const l_fp first)
177284990Scy{
178284990Scy	double res;
179284990Scy	LFPTOD(&first, res);
180284990Scy	return res;
181284990Scy}
182284990Scy
183289999Sglebiusl_fp
184289999Sglebiusl_fp_init_from_double( double rhs)
185284990Scy{
186284990Scy	l_fp temp;
187284990Scy	DTOLFP(rhs, &temp);
188284990Scy	return temp;
189284990Scy}
190284990Scy
191289999Sglebiusvoid
192289999Sglebiusl_fp_swap(l_fp * first, l_fp *second){
193284990Scy	l_fp temp = *second;
194284990Scy
195284990Scy	*second = *first;
196284990Scy	*first = temp;
197284990Scy}
198284990Scy
199289999Sglebius//----------------------------------------------------------------------
200289999Sglebius// testing the relational macros works better with proper predicate
201289999Sglebius// formatting functions; it slows down the tests a bit, but makes for
202289999Sglebius// readable failure messages.
203289999Sglebius//----------------------------------------------------------------------
204284990Scy
205289999Sglebius
206289999Sglebiusbool
207289999Sglebiusl_isgt (const l_fp first, const l_fp second) {
208289999Sglebius	return L_ISGT(&first, &second);
209284990Scy}
210284990Scy
211289999Sglebiusbool
212289999Sglebiusl_isgtu(const l_fp first, const l_fp second) {
213289999Sglebius	return L_ISGTU(&first, &second);
214289999Sglebius}
215284990Scy
216289999Sglebiusbool
217289999Sglebiusl_ishis(const l_fp first, const l_fp second) {
218289999Sglebius	return L_ISHIS(&first, &second);
219284990Scy}
220284990Scy
221289999Sglebiusbool
222289999Sglebiusl_isgeq(const l_fp first, const l_fp second) {
223289999Sglebius	return L_ISGEQ(&first, &second);
224284990Scy}
225284990Scy
226289999Sglebiusbool
227289999Sglebiusl_isequ(const l_fp first, const l_fp second) {
228289999Sglebius	return L_ISEQU(&first, &second);
229284990Scy}
230284990Scy
231284990Scy
232284990Scy//----------------------------------------------------------------------
233284990Scy// test data table for add/sub and compare
234284990Scy//----------------------------------------------------------------------
235284990Scy
236284990Scy
237284990Scystatic const lfp_hl addsub_tab[][3] = {
238284990Scy	// trivial idendity:
239284990Scy	{{0 ,0         }, { 0,0         }, { 0,0}},
240284990Scy	// with carry from fraction and sign change:
241284990Scy	{{-1,0x80000000}, { 0,0x80000000}, { 0,0}},
242284990Scy	// without carry from fraction
243284990Scy	{{ 1,0x40000000}, { 1,0x40000000}, { 2,0x80000000}},
244284990Scy	// with carry from fraction:
245284990Scy	{{ 1,0xC0000000}, { 1,0xC0000000}, { 3,0x80000000}},
246284990Scy	// with carry from fraction and sign change:
247284990Scy	{{0x7FFFFFFF, 0x7FFFFFFF}, {0x7FFFFFFF,0x7FFFFFFF}, {0xFFFFFFFE,0xFFFFFFFE}},
248284990Scy	// two tests w/o carry (used for l_fp<-->double):
249284990Scy	{{0x55555555,0xAAAAAAAA}, {0x11111111,0x11111111}, {0x66666666,0xBBBBBBBB}},
250284990Scy	{{0x55555555,0x55555555}, {0x11111111,0x11111111}, {0x66666666,0x66666666}},
251284990Scy	// wide-range test, triggers compare trouble
252284990Scy	{{0x80000000,0x00000001}, {0xFFFFFFFF,0xFFFFFFFE}, {0x7FFFFFFF,0xFFFFFFFF}}
253284990Scy};
254284990Scystatic const size_t addsub_cnt = (sizeof(addsub_tab)/sizeof(addsub_tab[0]));
255284990Scystatic const size_t addsub_tot = (sizeof(addsub_tab)/sizeof(addsub_tab[0][0]));
256284990Scy
257284990Scy
258284990Scy
259284990Scy//----------------------------------------------------------------------
260284990Scy// epsilon estimation for the precision of a conversion double --> l_fp
261284990Scy//
262284990Scy// The error estimation limit is as follows:
263284990Scy//  * The 'l_fp' fixed point fraction has 32 bits precision, so we allow
264284990Scy//    for the LSB to toggle by clamping the epsilon to be at least 2^(-31)
265284990Scy//
266284990Scy//  * The double mantissa has a precsion 54 bits, so the other minimum is
267284990Scy//    dval * (2^(-53))
268284990Scy//
269284990Scy//  The maximum of those two boundaries is used for the check.
270284990Scy//
271284990Scy// Note: once there are more than 54 bits between the highest and lowest
272284990Scy// '1'-bit of the l_fp value, the roundtrip *will* create truncation
273284990Scy// errors. This is an inherent property caused by the 54-bit mantissa of
274284990Scy// the 'double' type.
275289999Sglebiusdouble
276289999Sglebiuseps(double d)
277284990Scy{
278289999Sglebius	return fmax(ldexp(1.0, -31), ldexp(fabs(d), -53));
279284990Scy}
280284990Scy
281284990Scy//----------------------------------------------------------------------
282284990Scy// test addition
283284990Scy//----------------------------------------------------------------------
284289999Sglebiusvoid
285289999Sglebiustest_AdditionLR(void) {
286284990Scy
287289999Sglebius	size_t idx = 0;
288289999Sglebius	for (idx = 0; idx < addsub_cnt; ++idx) {
289284990Scy		l_fp op1 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
290284990Scy		l_fp op2 = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
291284990Scy		l_fp exp = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
292289999Sglebius		l_fp res = l_fp_add(op1, op2);
293284990Scy
294289999Sglebius		TEST_ASSERT_EQUAL_l_fp(exp, res);
295284990Scy	}
296284990Scy}
297284990Scy
298289999Sglebiusvoid
299289999Sglebiustest_AdditionRL(void) {
300289999Sglebius	size_t idx = 0;
301289999Sglebius	for (idx = 0; idx < addsub_cnt; ++idx) {
302284990Scy		l_fp op2 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
303284990Scy		l_fp op1 = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
304284990Scy		l_fp exp = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
305289999Sglebius		l_fp res = l_fp_add(op1, op2);
306284990Scy
307289999Sglebius		TEST_ASSERT_EQUAL_l_fp(exp, res);
308284990Scy	}
309284990Scy}
310284990Scy
311284990Scy
312284990Scy
313284990Scy//----------------------------------------------------------------------
314284990Scy// test subtraction
315284990Scy//----------------------------------------------------------------------
316289999Sglebiusvoid
317289999Sglebiustest_SubtractionLR(void) {
318289999Sglebius	size_t idx = 0;
319289999Sglebius	for (idx = 0; idx < addsub_cnt; ++idx) {
320284990Scy		l_fp op2 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
321284990Scy		l_fp exp = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
322284990Scy		l_fp op1 = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
323289999Sglebius		l_fp res = l_fp_subtract(op1, op2);
324284990Scy
325289999Sglebius		TEST_ASSERT_EQUAL_l_fp(exp, res);
326284990Scy	}
327284990Scy}
328284990Scy
329289999Sglebiusvoid
330289999Sglebiustest_SubtractionRL(void) {
331289999Sglebius	size_t idx = 0;
332289999Sglebius	for (idx = 0; idx < addsub_cnt; ++idx) {
333284990Scy		l_fp exp = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
334284990Scy		l_fp op2 = l_fp_init(addsub_tab[idx][1].h, addsub_tab[idx][1].l);
335284990Scy		l_fp op1 = l_fp_init(addsub_tab[idx][2].h, addsub_tab[idx][2].l);
336289999Sglebius		l_fp res = l_fp_subtract(op1, op2);
337284990Scy
338289999Sglebius		TEST_ASSERT_EQUAL_l_fp(exp, res);
339284990Scy	}
340284990Scy}
341284990Scy
342284990Scy//----------------------------------------------------------------------
343284990Scy// test negation
344284990Scy//----------------------------------------------------------------------
345284990Scy
346289999Sglebiusvoid
347289999Sglebiustest_Negation(void) {
348284990Scy
349289999Sglebius	size_t idx = 0;
350289999Sglebius	for (idx = 0; idx < addsub_cnt; ++idx) {
351284990Scy		l_fp op1 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
352284990Scy		l_fp op2 = l_fp_negate(op1);
353284990Scy		l_fp sum = l_fp_add(op1, op2);
354284990Scy
355289999Sglebius		l_fp zero = l_fp_init(0, 0);
356284990Scy
357289999Sglebius		TEST_ASSERT_EQUAL_l_fp(zero, sum);
358284990Scy	}
359284990Scy}
360284990Scy
361284990Scy
362284990Scy
363284990Scy//----------------------------------------------------------------------
364284990Scy// test absolute value
365284990Scy//----------------------------------------------------------------------
366289999Sglebiusvoid
367289999Sglebiustest_Absolute(void) {
368289999Sglebius	size_t idx = 0;
369289999Sglebius	for (idx = 0; idx < addsub_cnt; ++idx) {
370284990Scy		l_fp op1 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
371284990Scy		l_fp op2 = l_fp_abs(op1);
372284990Scy
373284990Scy		TEST_ASSERT_TRUE(l_fp_signum(op2) >= 0);
374284990Scy
375284990Scy		if (l_fp_signum(op1) >= 0)
376289999Sglebius			op1 = l_fp_subtract(op1, op2);
377284990Scy		else
378289999Sglebius			op1 = l_fp_add(op1, op2);
379284990Scy
380289999Sglebius		l_fp zero = l_fp_init(0, 0);
381284990Scy
382289999Sglebius		TEST_ASSERT_EQUAL_l_fp(zero, op1);
383284990Scy	}
384284990Scy
385284990Scy	// There is one special case we have to check: the minimum
386284990Scy	// value cannot be negated, or, to be more precise, the
387284990Scy	// negation reproduces the original pattern.
388284990Scy	l_fp minVal = l_fp_init(0x80000000, 0x00000000);
389284990Scy	l_fp minAbs = l_fp_abs(minVal);
390284990Scy	TEST_ASSERT_EQUAL(-1, l_fp_signum(minVal));
391284990Scy
392289999Sglebius	TEST_ASSERT_EQUAL_l_fp(minVal, minAbs);
393284990Scy}
394284990Scy
395284990Scy
396284990Scy//----------------------------------------------------------------------
397284990Scy// fp -> double -> fp rountrip test
398284990Scy//----------------------------------------------------------------------
399289999Sglebiusvoid
400289999Sglebiustest_FDF_RoundTrip(void) {
401284990Scy	// since a l_fp has 64 bits in it's mantissa and a double has
402284990Scy	// only 54 bits available (including the hidden '1') we have to
403284990Scy	// make a few concessions on the roundtrip precision. The 'eps()'
404284990Scy	// function makes an educated guess about the avilable precision
405284990Scy	// and checks the difference in the two 'l_fp' values against
406284990Scy	// that limit.
407289999Sglebius	size_t idx = 0;
408289999Sglebius	for (idx = 0; idx < addsub_cnt; ++idx) {
409284990Scy		l_fp op1 = l_fp_init(addsub_tab[idx][0].h, addsub_tab[idx][0].l);
410284990Scy		double op2 = l_fp_convert_to_double(op1);
411284990Scy		l_fp op3 = l_fp_init_from_double(op2);
412284990Scy
413289999Sglebius		l_fp temp = l_fp_subtract(op1, op3);
414284990Scy		double d = l_fp_convert_to_double(temp);
415289999Sglebius 		TEST_ASSERT_DOUBLE_WITHIN(eps(op2), 0.0, fabs(d));
416284990Scy	}
417284990Scy}
418284990Scy
419284990Scy
420284990Scy//----------------------------------------------------------------------
421284990Scy// test the compare stuff
422284990Scy//
423284990Scy// This uses the local compare and checks if the operations using the
424284990Scy// macros in 'ntp_fp.h' produce mathing results.
425284990Scy// ----------------------------------------------------------------------
426289999Sglebiusvoid
427289999Sglebiustest_SignedRelOps(void) {
428284990Scy	const lfp_hl * tv = (&addsub_tab[0][0]);
429284990Scy	size_t lc ;
430289999Sglebius	for (lc = addsub_tot - 1; lc; --lc, ++tv) {
431289999Sglebius		l_fp op1 = l_fp_init(tv[0].h, tv[0].l);
432289999Sglebius		l_fp op2 = l_fp_init(tv[1].h, tv[1].l);
433289999Sglebius		int cmp = l_fp_scmp(op1, op2);
434284990Scy
435284990Scy		switch (cmp) {
436284990Scy		case -1:
437284990Scy			//printf("op1:%d %d, op2:%d %d\n",op1.l_uf,op1.l_ui,op2.l_uf,op2.l_ui);
438289999Sglebius			l_fp_swap(&op1, &op2);
439284990Scy			//printf("op1:%d %d, op2:%d %d\n",op1.l_uf,op1.l_ui,op2.l_uf,op2.l_ui);
440284990Scy		case 1:
441289999Sglebius			TEST_ASSERT_TRUE (l_isgt(op1, op2));
442289999Sglebius			TEST_ASSERT_FALSE(l_isgt(op2, op1));
443284990Scy
444289999Sglebius			TEST_ASSERT_TRUE (l_isgeq(op1, op2));
445289999Sglebius			TEST_ASSERT_FALSE(l_isgeq(op2, op1));
446284990Scy
447289999Sglebius			TEST_ASSERT_FALSE(l_isequ(op1, op2));
448289999Sglebius			TEST_ASSERT_FALSE(l_isequ(op2, op1));
449284990Scy			break;
450284990Scy		case 0:
451289999Sglebius			TEST_ASSERT_FALSE(l_isgt(op1, op2));
452289999Sglebius			TEST_ASSERT_FALSE(l_isgt(op2, op1));
453284990Scy
454289999Sglebius			TEST_ASSERT_TRUE (l_isgeq(op1, op2));
455289999Sglebius			TEST_ASSERT_TRUE (l_isgeq(op2, op1));
456284990Scy
457289999Sglebius			TEST_ASSERT_TRUE (l_isequ(op1, op2));
458289999Sglebius			TEST_ASSERT_TRUE (l_isequ(op2, op1));
459284990Scy			break;
460284990Scy		default:
461284990Scy			TEST_FAIL_MESSAGE("unexpected UCMP result: " );
462284990Scy		}
463284990Scy	}
464284990Scy}
465284990Scy
466289999Sglebiusvoid
467289999Sglebiustest_UnsignedRelOps(void) {
468284990Scy	const lfp_hl * tv =(&addsub_tab[0][0]);
469284990Scy	size_t lc;
470289999Sglebius	for (lc = addsub_tot - 1; lc; --lc, ++tv) {
471289999Sglebius		l_fp op1 = l_fp_init(tv[0].h, tv[0].l);
472289999Sglebius		l_fp op2 = l_fp_init(tv[1].h, tv[1].l);
473289999Sglebius		int cmp = l_fp_ucmp(op1, op2);
474284990Scy
475284990Scy		switch (cmp) {
476284990Scy		case -1:
477284990Scy			//printf("op1:%d %d, op2:%d %d\n",op1.l_uf,op1.l_ui,op2.l_uf,op2.l_ui);
478284990Scy			l_fp_swap(&op1, &op2);
479284990Scy			//printf("op1:%d %d, op2:%d %d\n",op1.l_uf,op1.l_ui,op2.l_uf,op2.l_ui);
480284990Scy		case 1:
481289999Sglebius			TEST_ASSERT_TRUE (l_isgtu(op1, op2));
482289999Sglebius			TEST_ASSERT_FALSE(l_isgtu(op2, op1));
483284990Scy
484289999Sglebius			TEST_ASSERT_TRUE (l_ishis(op1, op2));
485289999Sglebius			TEST_ASSERT_FALSE(l_ishis(op2, op1));
486284990Scy			break;
487284990Scy		case 0:
488289999Sglebius			TEST_ASSERT_FALSE(l_isgtu(op1, op2));
489289999Sglebius			TEST_ASSERT_FALSE(l_isgtu(op2, op1));
490284990Scy
491289999Sglebius			TEST_ASSERT_TRUE (l_ishis(op1, op2));
492289999Sglebius			TEST_ASSERT_TRUE (l_ishis(op2, op1));
493284990Scy			break;
494284990Scy		default:
495284990Scy			TEST_FAIL_MESSAGE("unexpected UCMP result: " );
496284990Scy		}
497284990Scy	}
498284990Scy}
499284990Scy/*
500284990Scy*/
501284990Scy
502284990Scy//----------------------------------------------------------------------
503284990Scy// that's all folks... but feel free to add things!
504284990Scy//----------------------------------------------------------------------
505