summaryrefslogtreecommitdiff
path: root/src/KM_platform.h
diff options
context:
space:
mode:
authorjhurst <jhurst@cinecert.com>2015-10-07 16:41:23 +0000
committerjhurst <>2015-10-07 16:41:23 +0000
commitaf6a1e4ef13dcf5811ccd9eb6b63d21bdc88dc70 (patch)
tree021ae744f611d9bfd2f8832c665351132205ab0b /src/KM_platform.h
parent77200515d9acee07988f26dadfa37ffbd169cdfb (diff)
o Moved personal dev environment from older gcc to newer clang. Many small changes were made to satisfy the new compiler:
- Altered many printf format codes to use the correct type for the given integer type - Parenthesized some expressions to clarify previously ambiguous expectations of precedence - Created macro KM_MACOSX for use in OS-specific code selection - Removed last uses of the old C-language abs(), now using Kumu::xabs() - Removed last uses of the old C-language atoi() o Added platform-independent call Kumu::GetExecutablePath() (test with win32) o Fixed a bug that was causing Array properties to be written without the (count, length) header (from PAL) o Fixed Win32 build (from Crowe) o Added imlementation of SMPTE ST 2092-1 pink noise generator o Added pinkwave CLI utility o Added font support to the IMF timed-text wrapper
Diffstat (limited to 'src/KM_platform.h')
-rw-r--r--src/KM_platform.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/KM_platform.h b/src/KM_platform.h
index 578f545..defcd8a 100644
--- a/src/KM_platform.h
+++ b/src/KM_platform.h
@@ -1,5 +1,5 @@
/*
-Copyright (c) 2004-2012, John Hurst
+Copyright (c) 2004-2015, John Hurst
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -32,7 +32,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef _KM_PLATFORM_H_
# define _KM_PLATFORM_H_
-# ifdef __APPLE__
+#if defined(__APPLE__) && defined(__MACH__)
+# define KM_MACOSX
# ifdef __BIG_ENDIAN__
# define KM_BIG_ENDIAN
# endif
@@ -120,11 +121,17 @@ namespace Kumu
//
template<class T>
inline T xclamp(T v, T l, T h) {
- if ( v < l ) return l;
- if ( v > h ) return h;
+ if ( v < l ) { return l; }
+ if ( v > h ) { return h; }
return v;
}
+ //
+ template<class T>
+ inline T xabs(T n) {
+ if ( n < 0 ) { return -n; }
+ return n;
+ }
// read an integer from byte-structured storage
template<class T>
@@ -134,6 +141,7 @@ namespace Kumu
template<class T>
inline void i2p(T i, byte_t* p) { *(T*)p = i; }
+
# ifdef KM_BIG_ENDIAN
# define KM_i16_LE(i) Kumu::Swap2(i)
# define KM_i32_LE(i) Kumu::Swap4(i)