unpack.c revision ce2722f86de298ad1a8965f55a453b5723d2b2b9
1/* 2 * Internal routine for unpacking UUID 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 15void uuid_unpack(const uuid_t in, struct uuid *uu) 16{ 17 const __u8 *ptr = in; 18 __u32 tmp; 19 20 tmp = *ptr++; 21 tmp = (tmp << 8) | *ptr++; 22 tmp = (tmp << 8) | *ptr++; 23 tmp = (tmp << 8) | *ptr++; 24 uu->time_low = tmp; 25 26 tmp = *ptr++; 27 tmp = (tmp << 8) | *ptr++; 28 uu->time_mid = tmp; 29 30 tmp = *ptr++; 31 tmp = (tmp << 8) | *ptr++; 32 uu->time_hi_and_version = tmp; 33 34 tmp = *ptr++; 35 tmp = (tmp << 8) | *ptr++; 36 uu->clock_seq = tmp; 37 38 memcpy(uu->node, ptr, 6); 39} 40 41