use COPY_TO instead of a loop in fbytes_c1
& ryu comment changes
This commit is contained in:
parent
8da9c4e3a5
commit
7d4677a8ff
@ -660,9 +660,9 @@ B fchars_c2(B d, B w, B x) {
|
||||
static NFnDesc* fBytesDesc;
|
||||
B fbytes_c1(B d, B x) {
|
||||
I8Arr* tf = path_bytes(path_rel(nfn_objU(d), x));
|
||||
usz ia = PIA(tf); u8* p = (u8*)tf->a;
|
||||
usz ia = PIA(tf);
|
||||
u8* rp; B r = m_c8arrv(&rp, ia);
|
||||
for (i64 i = 0; i < ia; i++) rp[i] = p[i];
|
||||
COPY_TO(rp, el_i8, 0, taga(tf), 0, ia);
|
||||
ptr_dec(tf);
|
||||
return r;
|
||||
}
|
||||
|
||||
@ -455,7 +455,7 @@ static inline double int64Bits2Double(uint64_t bits) {
|
||||
}
|
||||
|
||||
bool ryu_s2d_n(u8* buffer, int len, f64* result) {
|
||||
assert(len>0 && len<(1<<20)); // max length so that '0.0000[a billion zeroes]0000e1000000000' doesn't have to be handled
|
||||
assert(len>0 && len<(1<<20)); // max length so that '0.0000[a billion zeroes]0001e1000000000' doesn't have to be handled
|
||||
int m10digits = 0;
|
||||
int dotIndex = len;
|
||||
int eIndex = len;
|
||||
@ -474,7 +474,7 @@ bool ryu_s2d_n(u8* buffer, int len, f64* result) {
|
||||
for (; i < len; i++) {
|
||||
char c = buffer[i];
|
||||
if (c == '.') {
|
||||
if (dotIndex!=len) return false;
|
||||
if (dotIndex!=len) return false; // "12.34.56"
|
||||
dotIndex = i;
|
||||
continue;
|
||||
}
|
||||
@ -508,7 +508,7 @@ bool ryu_s2d_n(u8* buffer, int len, f64* result) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i < len) return false;
|
||||
if (i < len) return false; // "123hello"
|
||||
if (signedE) e10 = -e10;
|
||||
|
||||
e10+= offset;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user