aboutsummaryrefslogtreecommitdiffhomepage
path: root/sample/memfunc.cpp
diff options
context:
space:
mode:
authorMITSUNARI Shigeo <[email protected]>2016-09-29 21:02:21 +0900
committerMITSUNARI Shigeo <[email protected]>2016-09-29 21:02:21 +0900
commit00c034d973f20008971a5456ba27a5e5f6632f94 (patch)
tree2267de5c1c82f84e5106b563a5a77ecf6d048b4c /sample/memfunc.cpp
parentac4ead3f3487c36fd055510ebbeb79b949c111b4 (diff)
downloadxbyak-00c034d973f20008971a5456ba27a5e5f6632f94.tar.gz
xbyak-00c034d973f20008971a5456ba27a5e5f6632f94.zip
remove some warnings
Diffstat (limited to 'sample/memfunc.cpp')
-rw-r--r--sample/memfunc.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/sample/memfunc.cpp b/sample/memfunc.cpp
index 3e69220..b97630b 100644
--- a/sample/memfunc.cpp
+++ b/sample/memfunc.cpp
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
+#include <memory.h>
#define XBYAK_NO_OP_NAMES
#include <xbyak/xbyak.h>
@@ -90,17 +91,8 @@ int main()
try {
Code code;
int (A::*p)(int, int, int, int, int) const = 0;
-#if defined(XBYAK32) && !defined(_WIN32)
- // avoid breaking strict-aliasing rules for 32bit gcc
- union {
- int (A::*p)(int, int, int, int, int) const;
- const Xbyak::uint8 *code;
- } u;
- u.code = code.getCode();
- p = u.p;
-#else
- *(void**)&p = code.getCode<void*>();
-#endif
+ const void *addr = code.getCode<void*>();
+ memcpy(&p, &addr, sizeof(void*));
for (int i = 0; i < 10; i++) {
A a;
int t1, t2, t3, t4, t5, x, y;