Skip to content
Snippets Groups Projects
Select Git revision
  • vectors-matrices-quaternions
  • next default protected
  • master protected
  • better-distance-math
  • movie
  • softcode-info
  • acs
  • clipmidtex
  • custom-map-names
  • nogravity-trampolines
  • 2214-pre4
  • 2214-pre3
  • just-in-case
  • fix-opengl-parameter-crash
  • 2214-pre2
  • 2214-pre1
  • delfile2
  • cleanupmusic
  • gametype-refactor-1
  • extra-textures
  • SRB2_release_2.2.15
  • SRB2_release_2.2.13
  • SRB2_release_2.2.12
  • SRB2_release_2.2.11
  • SRB2_release_2.2.10
  • SRB2_release_2.2.9
  • SRB2_release_2.2.8
  • SRB2_release_2.2.7
  • SRB2_release_2.2.6
  • SRB2_release_2.2.5
  • SRB2_release_2.2.4
  • SRB2_release_2.2.3
  • SRB2_release_2.2.2
  • SRB2_release_2.2.1
  • SRB2_release_2.2.0
  • SRB2_release_2.1.25
  • SRB2_release_2.1.24
  • SRB2_release_2.1.23
  • SRB2_release_2.1.22
  • SRB2_release_2.1.21
40 results

fastcmp.h

Blame
  • Alam Ed Arias's avatar
    Alam Ed Arias authored and Alam Arias committed
    b93cb1b6
    History
    fastcmp.h 790 B
    #ifndef __FASTCMP_H__
    #define __FASTCMP_H__
    
    // returns false if s != c
    // returns true if s == c
    FUNCINLINE static ATTRINLINE 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)
    {
    	for (; *s && *s == *c; s++, c++) ;
    	return (*s == *c); // make sure both strings ended
    }
    
    // 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)
    {
    	for (; *s && *s == *c && --l; s++, c++) ;
    	return !l; // make sure you reached the end
    }
    
    #endif