summaryrefslogtreecommitdiff
path: root/source/core/slang-cpu-defines.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2018-10-25 11:24:16 -0400
committerGitHub <noreply@github.com>2018-10-25 11:24:16 -0400
commit4f0415e338862ffec50c2d47eddea958255b504e (patch)
tree084c8e25552e328ed14eafcf0431493f58f973e8 /source/core/slang-cpu-defines.h
parent2700a89f8c80620f1d523563cc80ec0da39e9761 (diff)
Feature/premake linux (#689)
* Premake work in progress for linux. * Added dump function. * Remove examples on linux Small warning fix. * * Don't build render-test on linux * Removed work around virtual destructor warning, and just used virtual dtor for simplicity * Git ignore obj directories * Fix premake working on windows. * * Fix sprintf_s functions * Make generates arg parsing more robust * Added FloatIntUnion to avoid type punning/strong aliasing issues, and repeated union definitions. * Work around problems building on linux with getClass claiming a strict aliasing issue. * Fix for targetBlock appearing potentiall used unintialized to gcc. * Linux slang link options -fPIC to make dll. * Add -fPIC to build options on linux. * Add -ldl for linux on slang. * Fixes to try and get premake working with .so on linux. * Make core compile with -fPIC * Try to fix linux linking with --no-as-needed before -ldl * Add rpath back. * Remove render-gl from linux build. * Re-add location for linux. * Don't include <malloc.h> except on windows. * Remove unused line to fix warning on osx. * Remove ambiguity on OSX for operator <<. * Fixing ambiguity with operator overloading and Int types for OSX. * Fix ambiguity around UInt and operator * Fix ambiguity of UInt conversion for OSX. * Added UnambiguousInt and UnambiguousUInt to make it easier to work around OSX integer coercion for UInt/Int types.
Diffstat (limited to 'source/core/slang-cpu-defines.h')
-rw-r--r--source/core/slang-cpu-defines.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/core/slang-cpu-defines.h b/source/core/slang-cpu-defines.h
index dc76008b9..5ad1ecf88 100644
--- a/source/core/slang-cpu-defines.h
+++ b/source/core/slang-cpu-defines.h
@@ -54,6 +54,19 @@
#define SLANG_PTR_IS_64 (SLANG_PROCESSOR_ARM_64 | SLANG_PROCESSOR_X86_64 | SLANG_PROCESSOR_POWER_PC_64)
#define SLANG_PTR_IS_32 (SLANG_PTR_IS_64 ^ 1)
+// TODO: This isn't great. The problem is UInt maps to size_t, and on some targets (like OSX)
+// size_t is distinct from any other integral type. So that creates an ambiguity
+// Really we want to modify the StringBuilder and elsewhere to handle the case when it is known it can't unambiguously coerce
+namespace Slang {
+#ifdef SLANG_PTR_IS_64
+typedef UInt64 UnambigousUInt;
+typedef Int64 UnambiguousInt;
+#else
+typedef UInt32 UnambigousUInt;
+typedef Int32 UnambiguousInt;
+#endif
+} // namespace Slang
+
// Processor features
#if SLANG_PROCESSOR_FAMILY_X86
# define SLANG_LITTLE_ENDIAN 1