lib: rename stdlib surface to Hare names; add endian/math
Sweeping rename so the lib/ surface mirrors Hare's stdlib spellings. - ascii: rune-taking predicates; ishex -> isxdigit - bufio: rinit -> init; take1/takeline -> readbyte/readline - bytes: indexsub -> index - encoding/utf8: runelen -> runesz - errors: eEOF/eShortRead/... -> eof/underread/... - fmt: errln -> errorln; println/fprintln return i64 - os: readfull/writefull -> readall/writeall; unlink -> remove - path: isabs -> abs; drop lastindex (now strings.rbyteindex) - strconv: u64toa/i64toa -> u64tos/i64tos; parse64/parseu64 -> stoi64/stou64 - strings: drop len/isempty; equal -> compare; indexbyte -> byteindex; +rbyteindex - types: drop numeric helpers (moved to math) - new lib/endian (htonu16/ntohu16), lib/math (absi32/absi64) - net: drop htons (use endian.htonu16) Callers in selfhost/, lib/ww/, cmd/w6c/cgen.c, and test/wcc/700_e2e.c updated to match.
This commit is contained in:
@@ -790,7 +790,7 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
/* Use DIV (unsigned) when either operand is an unsigned
|
||||
* integer type — IDIV would sign-extend a u64 with high
|
||||
* bit set into a negative i64 and produce wrong results
|
||||
* (see strconv.u64toa with v = 1 << 63). */
|
||||
* (see strconv.u64tos with v = 1 << 63). */
|
||||
int unsignd = (n->lhs && type_isunsigned(n->lhs->type))
|
||||
|| (n->rhs && type_isunsigned(n->rhs->type));
|
||||
ins2(c, A_MOVQ, aimm(0), areg(D_DX));
|
||||
@@ -819,7 +819,7 @@ cgexpr(Cg *c, Node *n, Local *locals)
|
||||
/* For ordered comparisons on unsigned operands we must
|
||||
* use the JA/JAE/JB/JBE family — signed Jcc would treat
|
||||
* a u64 with the high bit set as negative (e.g. the
|
||||
* loop guard `n > 0` in strconv.u64toa with n=1<<63). */
|
||||
* loop guard `n > 0` in strconv.u64tos with n=1<<63). */
|
||||
int unsignd = (n->lhs && type_isunsigned(n->lhs->type))
|
||||
|| (n->rhs && type_isunsigned(n->rhs->type));
|
||||
ins2(c, A_CMPQ, areg(D_BX), areg(D_AX));
|
||||
|
||||
Reference in New Issue
Block a user