Permalink
Browse files

Min/Max functions for NSInteger that don't cause warnings on one arch…

…itecture or the other.
  • Loading branch information...
1 parent 65e5f00 commit f27c7fbc4d69f279e763bc8941b708366eef8dba @uliwitness committed Oct 16, 2011
Showing with 37 additions and 0 deletions.
  1. +37 −0 ULINSIntegerMath.h
View
37 ULINSIntegerMath.h
@@ -0,0 +1,37 @@
+//
+// ULINSIntegerMath.h
+// Stacksmith
+//
+// Created by Uli Kusterer on 16.10.11.
+// Copyright (c) 2011 Uli Kusterer. All rights reserved.
+//
+
+#ifndef Stacksmith_ULINSIntegerMath_h
+#define Stacksmith_ULINSIntegerMath_h
+
+#include <Foundation/Foundation.h>
+
+#if __cplusplus
+extern "C" {
+#endif
+
+static inline NSInteger ULINSIntegerMinimum( NSInteger a, NSInteger b );
+
+static inline NSInteger ULINSIntegerMinimum( NSInteger a, NSInteger b )
+{
+ return ((a < b) ? a : b);
+}
+
+
+static inline NSInteger ULINSIntegerMaximum( NSInteger a, NSInteger b );
+
+static inline NSInteger ULINSIntegerMaximum( NSInteger a, NSInteger b )
+{
+ return ((a > b) ? a : b);
+}
+
+#if __cplusplus
+}
+#endif
+
+#endif

0 comments on commit f27c7fb

Please sign in to comment.