diff options
author | H. Peter Anvin <hpa@zytor.com> | 2012-05-21 10:28:50 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-05-21 10:30:39 -0700 |
commit | 2024ab7832dea5dc004f712ffdf348b8239b8ffa (patch) | |
tree | 2742ee0588cdd8c8c2f47a3c14c4a28e8119b695 | |
parent | 4acc6da418c97dbd24b5999ee2d17f1ccf15d441 (diff) | |
download | klibc-2024ab7832dea5dc004f712ffdf348b8239b8ffa.tar.gz |
[klibc] lseek: give gcc a little optimization hint
It looks like gcc generates some epicly confused code for splitting
the two halves of the offset argument to lseek() at least on i386.
Copy it into an unsigned long long before breaking it apart seems to
help.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | usr/klibc/lseek.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/usr/klibc/lseek.c b/usr/klibc/lseek.c index a313bed6780b5..f262d1938c84f 100644 --- a/usr/klibc/lseek.c +++ b/usr/klibc/lseek.c @@ -18,13 +18,14 @@ extern int __llseek(int fd, unsigned long hi, unsigned long lo, off_t * res, off_t lseek(int fd, off_t offset, int whence) { + unsigned long long ullo = offset; off_t result; int rv; - rv = __llseek(fd, (unsigned long)(offset >> 32), (unsigned long)offset, + rv = __llseek(fd, (unsigned long)(ullo >> 32), (unsigned long)ullo, &result, whence); - return rv ? (off_t) - 1 : result; + return rv ? (off_t)-1 : result; } #endif |