Changeset 280a27e in mainline for genarch/src/softint/division.c
- Timestamp:
- 2006-04-16T13:16:44Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 50de918
- Parents:
- c624b96
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
genarch/src/softint/division.c
rc624b96 r280a27e 66 66 67 67 68 static unsigned long divandmod64(unsigned long a, unsigned long b, unsignedlong *remainder)68 static unsigned long long divandmod64(unsigned long long a, unsigned long long b, unsigned long long *remainder) 69 69 { 70 unsigned long result;71 int steps = sizeof(unsigned long ) * 8;70 unsigned long long result; 71 int steps = sizeof(unsigned long long) * 8; 72 72 73 73 *remainder = 0; … … 112 112 113 113 /* 64bit integer division */ 114 long __divdi3(long a,long b)114 long long __divdi3(long long a, long long b) 115 115 { 116 unsigned long rem;117 long result;116 unsigned long long rem; 117 long long result; 118 118 119 result = (long )divandmod64(ABSVAL(a), ABSVAL(b), &rem);119 result = (long long)divandmod64(ABSVAL(a), ABSVAL(b), &rem); 120 120 121 121 if ( SGN(a) == SGN(b)) return result; … … 131 131 132 132 /* 64bit unsigned integer division */ 133 unsigned long __udivdi3(unsigned long a, unsignedlong b)133 unsigned long long __udivdi3(unsigned long long a, unsigned long long b) 134 134 { 135 unsigned long rem;135 unsigned long long rem; 136 136 return divandmod64(a, b, &rem); 137 137 } … … 152 152 153 153 /* 64bit remainder of the signed division */ 154 long __moddi3(long a,long b)154 long long __moddi3(long long a,long long b) 155 155 { 156 unsigned long rem;156 unsigned long long rem; 157 157 divandmod64(a, b, &rem); 158 158 159 159 /* if divident is negative, remainder must be too */ 160 160 if (!(SGN(a))) { 161 return -((long )rem);161 return -((long long)rem); 162 162 } 163 163 164 return (long )rem;164 return (long long)rem; 165 165 } 166 166 … … 174 174 175 175 /* 64bit remainder of the unsigned division */ 176 unsigned long __umoddi3(unsigned long a, unsignedlong b)176 unsigned long long __umoddi3(unsigned long long a, unsigned long long b) 177 177 { 178 unsigned long rem;178 unsigned long long rem; 179 179 divandmod64(a, b, &rem); 180 180 return rem; 181 181 } 182 182 183 unsigned long __udivmoddi3(unsigned long a, unsigned long b, unsignedlong *c)183 unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b, unsigned long long *c) 184 184 { 185 185 return divandmod64(a, b, c);
Note:
See TracChangeset
for help on using the changeset viewer.