Hint added.
[AROS.git] / workbench / libs / uuid / uuid_compare.c
blobea67f09a3f54d44b63181be1f6e7742db2c746bd
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 "uuid_private.h"
14 #include LC_LIBDEFS_FILE
16 #define CHECK(f1, f2) if (f1 != f2) return f1 < f2 ? -1 : 1;
18 /*****************************************************************************
20 NAME */
21 AROS_LH2(int, UUID_Compare,
23 /* SYNOPSIS */
24 AROS_LHA(const uuid_t *, u1, A0),
25 AROS_LHA(const uuid_t *, u2, A1),
27 /* LOCATION */
28 struct uuid_base *, UUIDBase, 5, UUID)
30 /* FUNCTION
31 Compares between two UUIDs.
33 INPUTS
34 u1, u2 - UUIDs to be compared.
36 RESULT
37 <0 - if the u1 is lexically BEFORE u2
38 =0 - if u1 equals u2
39 >0 - if the u1 is lexically AFTER u2
41 NOTES
43 EXAMPLE
45 BUGS
47 SEE ALSO
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 int i;
57 ASSERT(u1);
58 ASSERT(u2);
60 CHECK(u1->time_low, u2->time_low);
61 CHECK(u1->time_mid, u2->time_mid);
63 CHECK(u1->time_hi_and_version, u2->time_hi_and_version); CHECK(u1->clock_seq_hi_and_reserved, u2->clock_seq_hi_and_reserved);
64 CHECK(u1->clock_seq_low, u2->clock_seq_low);
66 for (i = 0; i < 6; i++)
68 if (u1->node[i] < u2->node[i])
69 return -1;
70 if (u1->node[i] > u2->node[i])
71 return 1;
73 return 0;
75 AROS_LIBFUNC_EXIT