mirror of
https://github.com/golang/go
synced 2024-11-18 06:24:47 -07:00
runtime: save 8 stack bytes in timediv on arm.
Operations on int64 are very stack consuming with 5c. Fixes netbsd/arm build. Before: TEXT runtime.timediv+0(SB),7,$52-16 After: TEXT runtime.timediv+0(SB),7,$44-16 The stack usage is unchanged on 386: TEXT runtime.timediv+0(SB),7,$8-16 R=golang-dev, dvyukov, bradfitz CC=golang-dev https://golang.org/cl/12182044
This commit is contained in:
parent
727901410a
commit
a05237f20a
@ -421,16 +421,16 @@ runtime·timediv(int64 v, int32 div, int32 *rem)
|
||||
{
|
||||
int32 res, bit;
|
||||
|
||||
if(v >= div*0x7fffffffLL) {
|
||||
if(v >= (int64)div*0x7fffffffLL) {
|
||||
if(rem != nil)
|
||||
*rem = 0;
|
||||
return 0x7fffffff;
|
||||
}
|
||||
res = 0;
|
||||
for(bit = 0x40000000; bit != 0; bit >>= 1) {
|
||||
if(v >= (int64)bit*div) {
|
||||
v = v - (int64)bit*div;
|
||||
res += bit;
|
||||
for(bit = 30; bit >= 0; bit--) {
|
||||
if(v >= ((int64)div<<bit)) {
|
||||
v = v - ((int64)div<<bit);
|
||||
res += 1<<bit;
|
||||
}
|
||||
}
|
||||
if(rem != nil)
|
||||
|
Loading…
Reference in New Issue
Block a user