summaryrefslogtreecommitdiff
path: root/msgpack/sysdep.h
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@users.sourceforge.jp>2010-02-27 02:37:01 +0900
committerfrsyuki <frsyuki@users.sourceforge.jp>2010-02-27 02:37:01 +0900
commit27787505e0897eae05ee939ad846427cf1894c99 (patch)
tree305c3ac51f3345f555dab25f7df0741aa9c3a5de /msgpack/sysdep.h
parent7df178085341a5a4845d391ef7ec8317da3cc0ec (diff)
downloadmsgpack-python-27787505e0897eae05ee939ad846427cf1894c99.tar.gz
strict-aliasing rule 2
Diffstat (limited to 'msgpack/sysdep.h')
-rw-r--r--msgpack/sysdep.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/msgpack/sysdep.h b/msgpack/sysdep.h
index c69c69a..2bc01c9 100644
--- a/msgpack/sysdep.h
+++ b/msgpack/sysdep.h
@@ -1,7 +1,7 @@
/*
* MessagePack system dependencies
*
- * Copyright (C) 2008-2009 FURUHASHI Sadayuki
+ * Copyright (C) 2008-2010 FURUHASHI Sadayuki
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -101,5 +101,18 @@ typedef unsigned int _msgpack_atomic_counter_t;
#endif
+#define _msgpack_store16(to, num) \
+ do { uint16_t val = _msgpack_be16(num); memcpy(to, &val, 2); } while(0);
+#define _msgpack_store32(to, num) \
+ do { uint32_t val = _msgpack_be32(num); memcpy(to, &val, 4); } while(0);
+#define _msgpack_store64(to, num) \
+ do { uint64_t val = _msgpack_be64(num); memcpy(to, &val, 8); } while(0);
+
+
+#define _msgpack_load16(cast, from) ((cast)_msgpack_be16(*(uint16_t*)from))
+#define _msgpack_load32(cast, from) ((cast)_msgpack_be32(*(uint32_t*)from))
+#define _msgpack_load64(cast, from) ((cast)_msgpack_be64(*(uint64_t*)from))
+
+
#endif /* msgpack/sysdep.h */