aboutsummaryrefslogtreecommitdiff
path: root/src/include/emscripten.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/emscripten.h')
-rw-r--r--src/include/emscripten.h38
1 files changed, 2 insertions, 36 deletions
diff --git a/src/include/emscripten.h b/src/include/emscripten.h
index 958bef98..b06f3781 100644
--- a/src/include/emscripten.h
+++ b/src/include/emscripten.h
@@ -7,42 +7,8 @@
* http://emscripten.org
*/
-// ES_SIZEOF
-//
-// NOTE: As of now, ES_SIZEOF is not needed when using QUANTUM_SIZE
-// of 4. We will use the same offsets as C/C++ does in that case.
-// ES_SIZEOF is useful if QUANTUM_SIZE is 1.
-//
-// A 'safe' sizeof operator. Sadly llvm-gcc calculates sizeof's
-// and stores them hardcoded as raw values, unlike say offsets
-// within a structure which it nicely details using getelementptr.
-//
-// You should always use ES_SIZEOF|V instead of sizeof when using
-// Emscripten. Use ES_SIZEOF for types, ES_SIZEOV for values.
-//
-// Note that there is no way for Emscripten to know if you used
-// ES_SIZEOF properly, or if you did and and you used sizeof.
-// No warning will be shown if you do not use it.
-//
-// Sadly
-// #define ES_SIZEOF(x) int(&((x*)(NULL))[1])
-// does not work, since the compiler parses and hard-codes the
-// value. So we need to trick it with a function call.
-#ifdef EMSCRIPTEN
- template<class T>
- int es_sizeof(T* x) { return int(&x[1]); }
- #define ES_SIZEOF(T) es_sizeof((T*)0)
- template<class T>
- int es_sizeov(T* x) { return es_sizeof((T*)0); }
- #define ES_SIZEOV(V) es_sizeof(V)
-
- // Undefine normal archs, so asm is not attempted
- #define __EMSCRIPTEN__
- #undef __i386__
- #undef __x86_64__
-#else
- #define ES_SIZEOF(T) sizeof(T)
-#endif
+#undef __i386__
+#undef __x86_64__
// Interface to the underlying JS engine. This function will
// eval() the given script.