@@ -1,8 +1,8 @@
|
||||
// TODO fix https://github.com/andrewrk/zig/issues/140
|
||||
// and then make this able to run at compile time
|
||||
#static_eval_enable(false)
|
||||
pub fn len(ptr: &const u8) -> isize {
|
||||
var count: isize = 0;
|
||||
pub fn len(ptr: &const u8) -> usize {
|
||||
var count: usize = 0;
|
||||
while (ptr[count] != 0; count += 1) {}
|
||||
return count;
|
||||
}
|
||||
@@ -11,7 +11,7 @@ pub fn len(ptr: &const u8) -> isize {
|
||||
// and then make this able to run at compile time
|
||||
#static_eval_enable(false)
|
||||
pub fn cmp(a: &const u8, b: &const u8) -> i32 {
|
||||
var index: isize = 0;
|
||||
var index: usize = 0;
|
||||
while (a[index] == b[index] && a[index] != 0; index += 1) {}
|
||||
return a[index] - b[index];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user