Whamcloud - gitweb
ChangeLog, Makefile.in:
[tools/e2fsprogs.git] / lib / uuid / pack.c
1 /*
2  * Internal routine for packing UUID's
3  * 
4  * Copyright (C) 1996, 1997 Theodore Ts'o.
5  *
6  * %Begin-Header%
7  * This file may be redistributed under the terms of the GNU 
8  * Library General Public License.
9  * %End-Header%
10  */
11
12 #include <string.h>
13 #include "uuidP.h"
14
15 void uuid_pack(struct uuid *uu, uuid_t ptr)
16 {
17         __u32   tmp;
18         unsigned char   *out = ptr;
19
20         tmp = uu->time_low;
21         out[3] = (unsigned char) tmp;
22         tmp >>= 8;
23         out[2] = (unsigned char) tmp;
24         tmp >>= 8;
25         out[1] = (unsigned char) tmp;
26         tmp >>= 8;
27         out[0] = (unsigned char) tmp;
28         
29         tmp = uu->time_mid;
30         out[5] = (unsigned char) tmp;
31         tmp >>= 8;
32         out[4] = (unsigned char) tmp;
33
34         tmp = uu->time_hi_and_version;
35         out[7] = (unsigned char) tmp;
36         tmp >>= 8;
37         out[6] = (unsigned char) tmp;
38
39         tmp = uu->clock_seq;
40         out[9] = (unsigned char) tmp;
41         tmp >>= 8;
42         out[8] = (unsigned char) tmp;
43
44         memcpy(out+10, uu->node, 6);
45 }
46