1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-17 16:09:43 +03:00
Teaching the compiler that `buflen` cannot be negative and also doesn't
take a large value allows it to optimize code a little bit more than
it currently does.
This commit is contained in:
Rui Ueyama 2024-05-16 11:51:57 +09:00
parent ca4738d5e2
commit 416b0d336f
2 changed files with 2 additions and 2 deletions

View File

@ -739,7 +739,7 @@ public:
private:
u64 v0, v1, v2, v3;
u8 buf[8];
i64 buflen = 0;
u8 buflen = 0;
i64 total_bytes = 0;
};

View File

@ -51,7 +51,7 @@ SipHash::SipHash(u8 *key) {
void SipHash::update(u8 *msg, i64 msglen) {
total_bytes += msglen;
if (buflen > 0) {
if (buflen) {
if (buflen + msglen < 8) {
memcpy(buf + buflen, msg, msglen);
buflen += msglen;