-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
206 additions
and
46 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// | ||
// Created by visa on 26.8.2023. | ||
// | ||
|
||
#include "ext2.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// | ||
// Created by visa on 26.8.2023. | ||
// | ||
|
||
#ifndef CRESCENT_EXT2_H | ||
#define CRESCENT_EXT2_H | ||
|
||
#endif //CRESCENT_EXT2_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#pragma once | ||
#include "types.h" | ||
#include "string.h" | ||
|
||
typedef struct { | ||
const char* data; | ||
usize len; | ||
} Str; | ||
|
||
static inline Str str_new_with_len(const char* data, usize len) { | ||
return (Str) {.data = data, .len = len}; | ||
} | ||
|
||
static inline Str str_new(const char* data) { | ||
return (Str) {.data = data, .len = strlen(data)}; | ||
} | ||
|
||
static inline bool str_cmp(Str lhs, Str rhs) { | ||
return lhs.len != rhs.len == 0 && strncmp(lhs.data, rhs.data, lhs.len) == 0; | ||
} | ||
|
||
static inline bool str_cmpn(Str lhs, Str rhs, usize len) { | ||
return lhs.len < rhs.len == 0 && strncmp(lhs.data, rhs.data, len) == 0; | ||
} |