Skip to content

Instantly share code, notes, and snippets.

@sebsjoberg
Created January 28, 2014 21:33
Show Gist options
  • Save sebsjoberg/8676984 to your computer and use it in GitHub Desktop.
Save sebsjoberg/8676984 to your computer and use it in GitHub Desktop.
Mac OS X overloads for min and max.
// Returns char, int, short, or long, or the unsigned variety
// and takes two char, uchar, short, ushort, int, uint, long, ulong inputs.
#define __CLFN_ALL(name) char __OVERLOAD__ name(char x, char y); \
char2 __OVERLOAD__ name(char2 x, char2 y); \
char3 __OVERLOAD__ name(char3 x, char3 y); \
char4 __OVERLOAD__ name(char4 x, char4 y); \
char8 __OVERLOAD__ name(char8 x, char8 y); \
char16 __OVERLOAD__ name(char16 x, char16 y); \
uchar __OVERLOAD__ name(uchar x, uchar y); \
uchar2 __OVERLOAD__ name(uchar2 x, uchar2 y); \
uchar3 __OVERLOAD__ name(uchar3 x, uchar3 y); \
uchar4 __OVERLOAD__ name(uchar4 x, uchar4 y); \
uchar8 __OVERLOAD__ name(uchar8 x, uchar8 y); \
uchar16 __OVERLOAD__ name(uchar16 x,uchar16 y); \
short __OVERLOAD__ name(short x, short y); \
short2 __OVERLOAD__ name(short2 x, short2 y); \
short3 __OVERLOAD__ name(short3 x, short3 y); \
short4 __OVERLOAD__ name(short4 x, short4 y); \
short8 __OVERLOAD__ name(short8 x, short8 y); \
short16 __OVERLOAD__ name(short16 x, short16 y); \
ushort __OVERLOAD__ name(ushort x, ushort y); \
ushort2 __OVERLOAD__ name(ushort2 x, ushort2 y); \
ushort3 __OVERLOAD__ name(ushort3 x, ushort3 y); \
ushort4 __OVERLOAD__ name(ushort4 x, ushort4 y); \
ushort8 __OVERLOAD__ name(ushort8 x, ushort8 y); \
ushort16 __OVERLOAD__ name(ushort16 x, ushort16 y); \
int __OVERLOAD__ name(int x, int y); \
int2 __OVERLOAD__ name(int2 x, int2 y); \
int3 __OVERLOAD__ name(int3 x, int3 y); \
int4 __OVERLOAD__ name(int4 x, int4 y); \
int8 __OVERLOAD__ name(int8 x, int8 y); \
int16 __OVERLOAD__ name(int16 x, int16 y); \
uint __OVERLOAD__ name(uint x, uint y); \
uint2 __OVERLOAD__ name(uint2 x, uint2 y); \
uint3 __OVERLOAD__ name(uint3 x, uint3 y); \
uint4 __OVERLOAD__ name(uint4 x, uint4 y); \
uint8 __OVERLOAD__ name(uint8 x, uint8 y); \
uint16 __OVERLOAD__ name(uint16 x, uint16 y); \
long __OVERLOAD__ name(long x, long y); \
long2 __OVERLOAD__ name(long2 x, long2 y); \
long3 __OVERLOAD__ name(long3 x, long3 y); \
long4 __OVERLOAD__ name(long4 x, long4 y); \
long8 __OVERLOAD__ name(long8 x, long8 y); \
long16 __OVERLOAD__ name(long16 x, long16 y); \
ulong __OVERLOAD__ name(ulong x, ulong y); \
ulong2 __OVERLOAD__ name(ulong2 x, ulong2 y); \
ulong3 __OVERLOAD__ name(ulong3 x, ulong3 y); \
ulong4 __OVERLOAD__ name(ulong4 x, ulong4 y); \
ulong8 __OVERLOAD__ name(ulong8 x, ulong8 y); \
ulong16 __OVERLOAD__ name(ulong16 x, ulong16 y);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment