| ... | @@ -68,13 +68,13 @@ pub fn BitcodeWriter(comptime types: []const type) type { | ... | @@ -68,13 +68,13 @@ pub fn BitcodeWriter(comptime types: []const type) type { |
| 68 | in_bits -= n; | 68 | in_bits -= n; |
| 69 | | 69 | |
| 70 | if (self.bit_count != 0) return; | 70 | if (self.bit_count != 0) return; |
| 71 | try self.buffer.append(self.bit_buffer); | 71 | try self.buffer.append(std.mem.nativeToLittle(u32, self.bit_buffer)); |
| 72 | self.bit_buffer = 0; | 72 | self.bit_buffer = 0; |
| 73 | } | 73 | } |
| 74 | | 74 | |
| 75 | // Write 32-bit chunks of input bits | 75 | // Write 32-bit chunks of input bits |
| 76 | while (in_bits >= 32) { | 76 | while (in_bits >= 32) { |
| 77 | try self.buffer.append(@truncate(in_buffer)); | 77 | try self.buffer.append(std.mem.nativeToLittle(u32, @truncate(in_buffer))); |
| 78 | | 78 | |
| 79 | in_buffer >>= 31; | 79 | in_buffer >>= 31; |
| 80 | in_buffer >>= 1; | 80 | in_buffer >>= 1; |
| ... | @@ -153,7 +153,7 @@ pub fn BitcodeWriter(comptime types: []const type) type { | ... | @@ -153,7 +153,7 @@ pub fn BitcodeWriter(comptime types: []const type) type { |
| 153 | pub fn alignTo32(self: *BcWriter) Error!void { | 153 | pub fn alignTo32(self: *BcWriter) Error!void { |
| 154 | if (self.bit_count == 0) return; | 154 | if (self.bit_count == 0) return; |
| 155 | | 155 | |
| 156 | try self.buffer.append(self.bit_buffer); | 156 | try self.buffer.append(std.mem.nativeToLittle(u32, self.bit_buffer)); |
| 157 | self.bit_buffer = 0; | 157 | self.bit_buffer = 0; |
| 158 | self.bit_count = 0; | 158 | self.bit_count = 0; |
| 159 | } | 159 | } |
| ... | @@ -209,7 +209,7 @@ pub fn BitcodeWriter(comptime types: []const type) type { | ... | @@ -209,7 +209,7 @@ pub fn BitcodeWriter(comptime types: []const type) type { |
| 209 | try self.bitcode.alignTo32(); | 209 | try self.bitcode.alignTo32(); |
| 210 | | 210 | |
| 211 | // Set the number of words in the block at the start of the block | 211 | // Set the number of words in the block at the start of the block |
| 212 | self.bitcode.buffer.items[self.start] = @truncate(self.bitcode.length() - self.start - 1); | 212 | self.bitcode.buffer.items[self.start] = std.mem.nativeToLittle(u32, @truncate(self.bitcode.length() - self.start - 1)); |
| 213 | } | 213 | } |
| 214 | | 214 | |
| 215 | pub fn writeUnabbrev(self: *Self, code: u32, values: []const u64) Error!void { | 215 | pub fn writeUnabbrev(self: *Self, code: u32, values: []const u64) Error!void { |