mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-24 04:36:10 +03:00
simd: only ref buildable decls
This commit is contained in:
@ -2,16 +2,16 @@ const std = @import("std");
|
||||
|
||||
pub const isa = @import("isa.zig");
|
||||
pub const utf8 = @import("utf8.zig");
|
||||
const index_of = @import("index_of.zig");
|
||||
pub usingnamespace index_of;
|
||||
pub const index_of = @import("index_of.zig");
|
||||
|
||||
pub fn main() !void {
|
||||
//std.log.warn("ISA={}", .{isa.ISA.detect()});
|
||||
const input = "1234567\x1b1234567\x1b";
|
||||
//const input = "1234567812345678";
|
||||
std.log.warn("result={any}", .{index_of.indexOf(input, 0x1B)});
|
||||
std.log.warn("result={any}", .{utf8.utf8Validate(input)});
|
||||
}
|
||||
// TODO: temporary, only for zig build simd to inspect disasm easily
|
||||
// pub fn main() !void {
|
||||
// //std.log.warn("ISA={}", .{isa.ISA.detect()});
|
||||
// const input = "1234567\x1b1234567\x1b";
|
||||
// //const input = "1234567812345678";
|
||||
// std.log.warn("result={any}", .{index_of.indexOf(input, 0x1B)});
|
||||
// std.log.warn("result={any}", .{utf8.utf8Validate(input)});
|
||||
// }
|
||||
|
||||
test {
|
||||
@import("std").testing.refAllDecls(@This());
|
||||
|
@ -21,6 +21,10 @@ pub fn utf8ValidateNeon(input: []const u8) bool {
|
||||
return !neon.hasErrors();
|
||||
}
|
||||
|
||||
pub fn utf8ValidateScalar(input: []const u8) bool {
|
||||
return std.unicode.utf8ValidateSlice(input);
|
||||
}
|
||||
|
||||
pub const Neon = struct {
|
||||
/// The previous input in a vector. This is required because to check
|
||||
/// the validity of a UTF-8 byte, we need to sometimes know previous
|
||||
@ -52,7 +56,7 @@ pub const Neon = struct {
|
||||
var i: usize = 0;
|
||||
while (i + 16 <= input.len) : (i += 16) {
|
||||
const input_vec = aarch64.vld1q_u8(input[i..]);
|
||||
self.next(input_vec);
|
||||
self.process(input_vec);
|
||||
}
|
||||
|
||||
// If we have any data remaining, we pad it with zeroes since that
|
||||
@ -66,7 +70,7 @@ pub const Neon = struct {
|
||||
@memset(buf[remaining..], 0);
|
||||
|
||||
const input_vec = aarch64.vld1q_u8(&buf);
|
||||
self.next(input_vec);
|
||||
self.process(input_vec);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user