* minor optimization - make LIMIT not evaluate stuff like "atoi(balbla+strlen(stuff))" 3 times

This commit is contained in:
giantpune 2011-11-17 03:28:54 +00:00
parent 20a34e93d6
commit a14051ecca
2 changed files with 9 additions and 3 deletions

View File

@ -2,8 +2,8 @@
<app version="1"> <app version="1">
<name> USB Loader GX</name> <name> USB Loader GX</name>
<coder>USB Loader GX Team</coder> <coder>USB Loader GX Team</coder>
<version>2.3 r1131</version> <version>2.3 r1132</version>
<release_date>201111170248</release_date> <release_date>201111170321</release_date>
<!-- // remove this line to enable arguments <!-- // remove this line to enable arguments
<arguments> <arguments>
<arg>--ios=250</arg> <arg>--ios=250</arg>

View File

@ -2,7 +2,13 @@
#define TOOLS_H_ #define TOOLS_H_
#define ABS(x) ( (x) >= (0) ? (x) : (-(x)) ) #define ABS(x) ( (x) >= (0) ? (x) : (-(x)) )
#define LIMIT(x, min, max) ( ((x) < (min)) ? (min) : ((x) > (max)) ? (max) : (x) ) #define LIMIT(x, min, max) \
({ \
typeof( x ) _x = x; \
typeof( min ) _min = min; \
typeof( max ) _max = max; \
( ( ( _x ) < ( _min ) ) ? ( _min ) : ( ( _x ) > ( _max ) ) ? ( _max) : ( _x ) ); \
})
#define ALIGN(x) (((x) + 3) & ~3) #define ALIGN(x) (((x) + 3) & ~3)
#define ALIGN32(x) (((x) + 31) & ~31) #define ALIGN32(x) (((x) + 31) & ~31)