aboutsummaryrefslogtreecommitdiff
path: root/libk/string.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libk/string.cc')
-rw-r--r--libk/string.cc22
1 files changed, 11 insertions, 11 deletions
diff --git a/libk/string.cc b/libk/string.cc
index 5cd4bb2..c75feb1 100644
--- a/libk/string.cc
+++ b/libk/string.cc
@@ -8,19 +8,19 @@
// int strncmp(const char *s1, const char *s2, int c);
/* strcmp - compare two C-strings */
-constexpr int strcmp(const char *s1, const char *s2)
-{
- const auto s1_len = strlen(s1);
- for(size_t i = 0; i < s1_len; ++i) {
- if(s1[i] == s2[i]) continue;
- if(s1[i] > s2[i]) return 1;
- if(s1[i] < s2[i]) return -1;
- }
- return 0;
+constexpr int strcmp(const char* s1, const char* s2) {
+ const auto s1_len = strlen(s1);
+ for (size_t i = 0; i < s1_len; ++i) {
+ if (s1[i] == s2[i])
+ continue;
+ if (s1[i] > s2[i])
+ return 1;
+ if (s1[i] < s2[i])
+ return -1;
+ }
+ return 0;
}
static_assert(strcmp("one", "one") == 0);
static_assert(strcmp("one", "two") < 0);
static_assert(strcmp("foo", "bar") > 0);
-
-