summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim McDonough <jmcd@samba.org>2002-08-12 16:39:10 +0000
committerJim McDonough <jmcd@samba.org>2002-08-12 16:39:10 +0000
commitf3a15363d82b5b6204948ef623ad87c855dd5f57 (patch)
treea10d308d28fd0edee2f28c269c0d731cfb8d775d
parentcebad9a48dfb0da13ab71bd861199ce26c31c947 (diff)
downloadsamba-f3a15363d82b5b6204948ef623ad87c855dd5f57.tar.gz
samba-f3a15363d82b5b6204948ef623ad87c855dd5f57.tar.bz2
samba-f3a15363d82b5b6204948ef623ad87c855dd5f57.zip
Use byteorder.h macros
(This used to be commit eb9004efc3580799063009a8298c35cbc420626f)
-rw-r--r--source3/lib/util_uuid.c54
1 files changed, 9 insertions, 45 deletions
diff --git a/source3/lib/util_uuid.c b/source3/lib/util_uuid.c
index b70db8de5b..63e2504982 100644
--- a/source3/lib/util_uuid.c
+++ b/source3/lib/util_uuid.c
@@ -38,60 +38,24 @@ struct uuid {
static void uuid_pack(const struct uuid *uu, GUID *ptr)
{
- uint32 tmp;
uint8 *out = ptr->info;
- tmp = uu->time_low;
- out[3] = (uint8) tmp;
- tmp >>= 8;
- out[2] = (uint8) tmp;
- tmp >>= 8;
- out[1] = (uint8) tmp;
- tmp >>= 8;
- out[0] = (uint8) tmp;
-
- tmp = uu->time_mid;
- out[5] = (uint8) tmp;
- tmp >>= 8;
- out[4] = (uint8) tmp;
-
- tmp = uu->time_hi_and_version;
- out[7] = (uint8) tmp;
- tmp >>= 8;
- out[6] = (uint8) tmp;
-
- tmp = uu->clock_seq;
- out[9] = (uint8) tmp;
- tmp >>= 8;
- out[8] = (uint8) tmp;
-
+ SIVAL(out, 0, uu->time_low);
+ SSVAL(out, 4, uu->time_mid);
+ SSVAL(out, 6, uu->time_hi_and_version);
+ SSVAL(out, 8, uu->clock_seq);
memcpy(out+10, uu->node, 6);
}
static void uuid_unpack(const GUID in, struct uuid *uu)
{
const uint8 *ptr = in.info;
- uint32 tmp;
-
- tmp = *ptr++;
- tmp = (tmp << 8) | *ptr++;
- tmp = (tmp << 8) | *ptr++;
- tmp = (tmp << 8) | *ptr++;
- uu->time_low = tmp;
-
- tmp = *ptr++;
- tmp = (tmp << 8) | *ptr++;
- uu->time_mid = tmp;
-
- tmp = *ptr++;
- tmp = (tmp << 8) | *ptr++;
- uu->time_hi_and_version = tmp;
-
- tmp = *ptr++;
- tmp = (tmp << 8) | *ptr++;
- uu->clock_seq = tmp;
- memcpy(uu->node, ptr, 6);
+ uu->time_low = IVAL(ptr, 0);
+ uu->time_mid = SVAL(ptr, 4);
+ uu->time_hi_and_version = SVAL(ptr, 6);
+ uu->clock_seq = SVAL(ptr, 8);
+ memcpy(uu->node, ptr+10, 6);
}
void uuid_generate_random(GUID *out)