Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…itecture or the other.
  • Loading branch information...
commit f27c7fbc4d69f279e763bc8941b708366eef8dba 1 parent 65e5f00
@uliwitness authored
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
Please sign in to comment.
Something went wrong with that request. Please try again.