ref: f648c7322860643fbf38d520c39c13e23ed23f71
parent: 92cfd764bf08dcd464f2edf2992ca67cc847b1e9
author: eli <eli@owl>
date: Fri Jul 11 22:04:37 EDT 2025
github.com/karpathy/llama2.c
--- a/llama2.c
+++ b/llama2.c
@@ -43,22 +43,6 @@
#define SIZEOFCONFIG 24
-vlong read8(int fd) {
- vlong result;
- int buf[8];
- int i;
-
- if (read(fd, buf, 8) != 8)
- exit(EXIT_FAILURE);
-
- result = 0;
-
- for (i = 0; i < 8; i++)
- result |= ((vlong)buf[i] << (i*8));
-
- return result;
-}
-
int read4(int fd) {
typedef union _result {
char buf[4];
@@ -516,7 +500,7 @@
// careful, some tokens designate raw bytes, and look like e.g. '<0x01>'
// parse this and convert and return the actual byte
unsigned char byte_val;
- if (sscanf(piece, "<0x%02hhX>", &byte_val) == 1) {
+ if (sscanf(piece, "<0x%X>", &byte_val) == 1) {
piece = (char*)t->byte_pieces + byte_val * 2;
}
return piece;
--
⑨