zig style

This commit is contained in:
Folkert 2020-12-04 01:17:11 +01:00
parent fe5e4d33bc
commit 4f549b7889

View file

@ -108,7 +108,8 @@ const RocStr = extern struct {
var index: usize = 0; var index: usize = 0;
// TODO rewrite this into a for loop // TODO rewrite this into a for loop
while (index < self.len()) { const length = self.len();
while (index < length) {
if (self_bytes[index] != other_bytes[index]) { if (self_bytes[index] != other_bytes[index]) {
return false; return false;
} }
@ -220,7 +221,7 @@ const RocStr = extern struct {
// Str.numberOfBytes // Str.numberOfBytes
pub fn strNumberOfBytes(string: RocStr) callconv(.C) u64 { pub fn strNumberOfBytes(string: RocStr) callconv(.C) usize {
return string.len(); return string.len();
} }