fastcmp.h: mark fastcmp functions as pure
this might let the compiler optimize aways subsequent calls in some cases strcmp etc from glibc also does it prayin nothin changes the locale at runtime lmao
This commit is contained in:
1 parent
1ccd3e37bc
commit
2c7c9ec32a
1 file changed
+3
-3
+3
-3
@@ -3,14 +3,14 @@
|
||||
|
||||
// returns false if s != c
|
||||
// returns true if s == c
|
||||
FUNCINLINE static ATTRINLINE boolean fasticmp(const char *s, const char *c)
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC boolean fasticmp(const char *s, const char *c)
|
||||
{
|
||||
for (; *s && toupper(*s) == toupper(*c); s++, c++) ;
|
||||
return (*s == *c); // make sure both strings ended
|
||||
}
|
||||
|
||||
// case-sensitive of the above
|
||||
FUNCINLINE static ATTRINLINE boolean fastcmp(const char *s, const char *c)
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC boolean fastcmp(const char *s, const char *c)
|
||||
{
|
||||
for (; *s && *s == *c; s++, c++) ;
|
||||
return (*s == *c); // make sure both strings ended
|
||||
@@ -18,7 +18,7 @@ FUNCINLINE static ATTRINLINE boolean fastcmp(const char *s, const char *c)
|
||||
|
||||
// length-limited of the above
|
||||
// only true if both strings are at least l characters long AND match, case-sensitively!
|
||||
FUNCINLINE static ATTRINLINE boolean fastncmp(const char *s, const char *c, UINT16 l)
|
||||
FUNCINLINE static ATTRINLINE PUREFUNC boolean fastncmp(const char *s, const char *c, UINT16 l)
|
||||
{
|
||||
for (; *s && *s == *c && --l; s++, c++) ;
|
||||
return !l; // make sure you reached the end
|
||||
|
||||
Reference in new issue
Block a user