Updated PCI IDs to latest snapshot.
[tangerine.git] / workbench / libs / uuid / uuid_compare.c
blob3770eb409831edb6b51b2df8bffe7341c2db3eb9
1 /*
2 Copyright © 2007-2008, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #define DEBUG 1
8 #include <aros/symbolsets.h>
9 #include <aros/debug.h>
10 #include <aros/libcall.h>
11 #include <proto/exec.h>
13 #include <assert.h>
15 #include "uuid_private.h"
16 #include LC_LIBDEFS_FILE
18 #define CHECK(f1, f2) if (f1 != f2) return f1 < f2 ? -1 : 1;
20 /*****************************************************************************
22 NAME */
23 AROS_LH2(int, UUID_Compare,
25 /* SYNOPSIS */
26 AROS_LHA(const uuid_t *, u1, A0),
27 AROS_LHA(const uuid_t *, u2, A1),
29 /* LOCATION */
30 struct uuid_base *, UUIDBase, 5, UUID)
32 /* FUNCTION
33 Compares between two UUIDs.
35 INPUTS
36 u1, u2 - UUIDs to be compared.
38 RESULT
39 <0 - if the u1 is lexically BEFORE u2
40 =0 - if u1 equals u2
41 >0 - if the u1 is lexically AFTER u2
43 NOTES
45 EXAMPLE
47 BUGS
49 SEE ALSO
51 INTERNALS
53 *****************************************************************************/
55 AROS_LIBFUNC_INIT
57 int i;
59 assert(u1);
60 assert(u2);
62 CHECK(u1->time_low, u2->time_low);
63 CHECK(u1->time_mid, u2->time_mid);
65 CHECK(u1->time_hi_and_version, u2->time_hi_and_version); CHECK(u1->clock_seq_hi_and_reserved, u2->clock_seq_hi_and_reserved);
66 CHECK(u1->clock_seq_low, u2->clock_seq_low);
68 for (i = 0; i < 6; i++)
70 if (u1->node[i] < u2->node[i])
71 return -1;
72 if (u1->node[i] > u2->node[i])
73 return 1;
75 return 0;
77 AROS_LIBFUNC_EXIT