mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 18:38:55 +00:00
Various CSS fixing and stability stuff (#16889)
This commit is contained in:
@@ -4642,11 +4642,10 @@ pub fn trimLeadingChar(slice: []const u8, char: u8) []const u8 {
|
||||
/// e.g.
|
||||
/// `trimLeadingPattern2("abcdef", 'a', 'b') == "cdef"`
|
||||
pub fn trimLeadingPattern2(slice_: []const u8, comptime byte1: u8, comptime byte2: u8) []const u8 {
|
||||
const pattern: u16 = comptime @as(u16, byte2) << 8 | @as(u16, byte1);
|
||||
// const pattern: u16 = comptime @as(u16, byte2) << 8 | @as(u16, byte1);
|
||||
var slice = slice_;
|
||||
while (slice.len >= 2) {
|
||||
const sliceu16: [*]const u16 = @ptrCast(@alignCast(slice.ptr));
|
||||
if (sliceu16[0] == pattern) {
|
||||
if (slice[0] == byte1 and slice[1] == byte2) {
|
||||
slice = slice[2..];
|
||||
} else {
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user