e2fsprogs/lib/uuid/pack.c

47 lines
853 B
C
Raw Normal View History

1997-04-29 18:53:37 +04:00
/*
* Internal routine for packing UUID's
1997-04-29 20:17:09 +04:00
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
1997-04-29 18:53:37 +04:00
*/
1997-04-29 20:17:09 +04:00
#include <string.h>
1997-04-29 18:53:37 +04:00
#include "uuidP.h"
void uuid_pack(struct uuid *uu, uuid_t ptr)
{
__u32 tmp;
unsigned char *out = ptr;
tmp = uu->time_low;
out[3] = (unsigned char) tmp;
tmp >>= 8;
out[2] = (unsigned char) tmp;
tmp >>= 8;
out[1] = (unsigned char) tmp;
tmp >>= 8;
out[0] = (unsigned char) tmp;
tmp = uu->time_mid;
out[5] = (unsigned char) tmp;
tmp >>= 8;
out[4] = (unsigned char) tmp;
tmp = uu->time_hi_and_version;
out[7] = (unsigned char) tmp;
tmp >>= 8;
out[6] = (unsigned char) tmp;
tmp = uu->clock_seq;
out[9] = (unsigned char) tmp;
tmp >>= 8;
out[8] = (unsigned char) tmp;
memcpy(out+10, uu->node, 6);
}