Commit c7d5c438 authored by Russ Cox's avatar Russ Cox

runtime: adjust timediv to avoid _vasop; mark _subv okay

R=dvyukov
CC=golang-dev
https://golang.org/cl/12028046
parent 98cc58e2
...@@ -429,7 +429,7 @@ runtime·timediv(int64 v, int32 div, int32 *rem) ...@@ -429,7 +429,7 @@ runtime·timediv(int64 v, int32 div, int32 *rem)
res = 0; res = 0;
for(bit = 0x40000000; bit != 0; bit >>= 1) { for(bit = 0x40000000; bit != 0; bit >>= 1) {
if(v >= (int64)bit*div) { if(v >= (int64)bit*div) {
v -= (int64)bit*div; v = v - (int64)bit*div;
res += bit; res += bit;
} }
} }
......
...@@ -66,27 +66,20 @@ void runtime·abort(void); ...@@ -66,27 +66,20 @@ void runtime·abort(void);
void void
_addv(Vlong *r, Vlong a, Vlong b) _addv(Vlong *r, Vlong a, Vlong b)
{ {
ulong lo, hi; r->lo = a.lo + b.lo;
r->hi = a.hi + b.hi;
lo = a.lo + b.lo; if(r->lo < a.lo)
hi = a.hi + b.hi; r->hi++;
if(lo < a.lo)
hi++;
r->lo = lo;
r->hi = hi;
} }
#pragma textflag 7
void void
_subv(Vlong *r, Vlong a, Vlong b) _subv(Vlong *r, Vlong a, Vlong b)
{ {
ulong lo, hi; r->lo = a.lo - b.lo;
r->hi = a.hi - b.hi;
lo = a.lo - b.lo; if(r->lo > a.lo)
hi = a.hi - b.hi; r->hi--;
if(lo > a.lo)
hi--;
r->lo = lo;
r->hi = hi;
} }
void void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment