commit 77b823ca04f4f0d674730586ad5f119cad4d256d
parent de846c8041fe1d7824611dc1dbcaebafa64619fb
Author: benjamin paul <bpaul@bpaul.xyz>
Date: Sun, 12 Sep 2021 19:20:13 +1000
remove pointless newstrncmp thing
Diffstat:
M | src/main.c | | | 39 | +-------------------------------------- |
1 file changed, 1 insertion(+), 38 deletions(-)
diff --git a/src/main.c b/src/main.c
@@ -5,44 +5,7 @@
#define VERSION "v0.0.1"
/* sizeof magically gets the length of the string! (plus \0) */
-#define CMD(s) new_strncmp(buf, s, sizeof(s)-1) == 0
-
-/* A modified version of the strncmp code which is somehow faster */
-bool
-new_strncmp(const char *s1, const char *s2, unsigned long n) {
- int i;
-
- char c[4];
-
- if (n >= 4) {
- unsigned long n4 = n >> 2;
- do {
- for (i = 0; i < 4; i++) {
- c[i] = s1[i] - s2[i];
- if (s1[i] == '\0' || c[i] != 0) {
- return c[i];
- }
- }
-
- s1+=4;
- s2+=4;
-
- n4--;
- } while (n4 > 0);
- n &= 3;
- }
-
- while (n > 0) {
- c[0] = *s1 - *s2;
- if (*s1 == '\0' || c[0] != 0) {
- return c[0];
- }
- s1++;
- s2++;
- }
-
- return c[0];
-}
+#define CMD(s) strncmp(buf, s, sizeof(s)-1) == 0
int
main() {