Changeset 2467b41 in mainline
- Timestamp:
- 2018-01-17T16:58:41Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 17c14273
- Parents:
- 33b8d024
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-17 16:58:14)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-01-17 16:58:41)
- Location:
- uspace/lib/softint
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/softint/generic/comparison.c
r33b8d024 r2467b41 34 34 */ 35 35 36 #include <alias.h>37 36 #include <comparison.h> 38 37 #include <lltype.h> … … 42 41 #define GREATER 2; 43 42 44 int __cmp ti2 (long long a, long long b)43 int __cmpdi2 (long long a, long long b) 45 44 { 46 45 union lltype lla; … … 65 64 } 66 65 67 int __ucmp ti2 (unsigned long long a, unsigned long long b)66 int __ucmpdi2 (unsigned long long a, unsigned long long b) 68 67 { 69 68 union lltype lla; … … 88 87 } 89 88 90 #if LONG_MAX == LLONG_MAX91 int ALIAS(__cmp, i2);92 int ALIAS(__ucmp, i2);93 #else94 95 int __cmpdi2(long a, long b)96 {97 if ((int)a < (int)b) {98 return LESSER;99 } else if ((int)a > (int)b) {100 return GREATER;101 } else {102 return EQUAL;103 }104 }105 106 int __ucmpdi2(unsigned long a, unsigned long b)107 {108 if ((int)a < (int)b) {109 return LESSER;110 } else if ((int)a > (int)b) {111 return GREATER;112 } else {113 return EQUAL;114 }115 }116 117 #endif118 119 89 /** @} 120 90 */ -
uspace/lib/softint/generic/division.c
r33b8d024 r2467b41 35 35 */ 36 36 37 #include <alias.h>38 37 #include <division.h> 39 38 … … 122 121 123 122 /* 64bit integer division */ 124 long long __div ti3(long long a, long long b)123 long long __divdi3(long long a, long long b) 125 124 { 126 125 unsigned long long rem; … … 141 140 142 141 /* 64bit unsigned integer division */ 143 unsigned long long __udiv ti3(unsigned long long a, unsigned long long b)142 unsigned long long __udivdi3(unsigned long long a, unsigned long long b) 144 143 { 145 144 unsigned long long rem; … … 161 160 162 161 /* 64bit remainder of the signed division */ 163 long long __mod ti3(long long a, long long b)162 long long __moddi3(long long a, long long b) 164 163 { 165 164 unsigned long long rem; … … 182 181 183 182 /* 64bit remainder of the unsigned division */ 184 unsigned long long __umod ti3(unsigned long long a, unsigned long long b)183 unsigned long long __umoddi3(unsigned long long a, unsigned long long b) 185 184 { 186 185 unsigned long long rem; … … 203 202 } 204 203 205 int __divmodsi4(int a, int b, int *c)206 {207 return __divmodsi3(a, b, c);208 }209 210 204 unsigned int __udivmodsi3(unsigned int a, unsigned int b, 211 205 unsigned int *c) … … 214 208 } 215 209 216 unsigned int __udivmodsi4(unsigned int a, unsigned int b, 217 unsigned int *c) 218 { 219 return divandmod32(a, b, c); 220 } 221 222 long long __divmodti3(long long a, long long b, long long *c) 210 long long __divmoddi3(long long a, long long b, long long *c) 223 211 { 224 212 unsigned long long rem; … … 234 222 } 235 223 236 237 long long __divmodti4(long long a, long long b, long long *c) 224 long long __divmoddi4(long long a, long long b, long long *c) 238 225 { 239 226 unsigned long long rem; … … 249 236 } 250 237 251 unsigned long long __udivmod ti3(unsigned long long a, unsigned long long b,238 unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b, 252 239 unsigned long long *c) 253 240 { … … 255 242 } 256 243 257 unsigned long long __udivmod ti4(unsigned long long a, unsigned long long b,244 unsigned long long __udivmoddi4(unsigned long long a, unsigned long long b, 258 245 unsigned long long *c) 259 246 { 260 247 return divandmod64(a, b, c); 261 248 } 262 263 long ALIAS(__div, i3);264 long ALIAS(__mod, i3);265 long ALIAS(__divmod, i3);266 long ALIAS(__divmod, i4);267 unsigned long ALIAS(__udiv, i3);268 unsigned long ALIAS(__umod, i3);269 unsigned long ALIAS(__udivmod, i3);270 unsigned long ALIAS(__udivmod, i4);271 249 272 250 /** @} -
uspace/lib/softint/generic/multiplication.c
r33b8d024 r2467b41 35 35 */ 36 36 37 #include <alias.h>38 37 #include <multiplication.h> 39 38 #include <stdint.h> … … 68 67 * 69 68 */ 70 long long __mul ti3 (long long a, long long b)69 long long __muldi3 (long long a, long long b) 71 70 { 72 71 char neg = 0; … … 121 120 } 122 121 123 #if LONG_MAX == LLONG_MAX124 long ALIAS(__mul, i3);125 #else126 long __muldi3(long a, long b)127 {128 return (int)a * (int)b;129 }130 #endif131 132 122 /** @} 133 123 */ -
uspace/lib/softint/generic/shift.c
r33b8d024 r2467b41 34 34 */ 35 35 36 #include <alias.h>37 36 #include <shift.h> 38 37 #include <lltype.h> 39 38 40 long long __ashl ti3 (long long val, int shift)39 long long __ashldi3 (long long val, int shift) 41 40 { 42 41 union lltype ll; … … 66 65 } 67 66 68 long long __ashr ti3 (long long val, int shift)67 long long __ashrdi3 (long long val, int shift) 69 68 { 70 69 union lltype ll; … … 96 95 } 97 96 98 long long __lshr ti3 (long long val, int shift)97 long long __lshrdi3 (long long val, int shift) 99 98 { 100 99 union lltype ll; … … 126 125 long long __aeabi_llsl(long long val, int shift) 127 126 { 128 return __ashl ti3(val, shift);127 return __ashldi3(val, shift); 129 128 } 130 129 131 130 long long __aeabi_llsr(long long val, int shift) 132 131 { 133 return __lshr ti3(val, shift);132 return __lshrdi3(val, shift); 134 133 } 135 136 #if LONG_MAX == LLONG_MAX137 long ALIAS(__ashl, i3);138 long ALIAS(__ashr, i3);139 long ALIAS(__lshr, i3);140 #else141 142 long __ashldi3(long val, int shift)143 {144 return ((int) val) << shift;145 }146 147 long __ashrdi3(long val, int shift)148 {149 return ((int) val) >> shift;150 }151 152 long __lshrdi3(long val, int shift)153 {154 return ((unsigned int) val) >> shift;155 }156 157 #endif158 134 159 135 /** @} -
uspace/lib/softint/include/comparison.h
r33b8d024 r2467b41 38 38 39 39 /* Signed comparison (a < b => 0, a == b => 1, a > b => 2). */ 40 extern int __cmpdi2(long, long); 41 extern int __cmpti2(long long, long long); 40 extern int __cmpdi2(long long, long long); 42 41 43 42 /* Unsigned comparison (a < b => 0, a == b => 1, a > b => 2). */ 44 extern int __ucmpdi2(unsigned long, unsigned long); 45 extern int __ucmpti2(unsigned long long, unsigned long long); 43 extern int __ucmpdi2(unsigned long long, unsigned long long); 46 44 47 45 #endif -
uspace/lib/softint/include/division.h
r33b8d024 r2467b41 38 38 39 39 extern int __divsi3(int, int); 40 extern long __divdi3(long, long); 41 extern long long __divti3(long long, long long); 40 extern long long __divdi3(long long, long long); 42 41 43 42 extern unsigned int __udivsi3(unsigned int, unsigned int); 44 extern unsigned long __udivdi3(unsigned long, unsigned long); 45 extern unsigned long long __udivti3(unsigned long long, unsigned long long); 43 extern unsigned long long __udivdi3(unsigned long long, unsigned long long); 46 44 47 45 extern int __modsi3(int, int); 48 extern long __moddi3(long, long); 49 extern long long __modti3(long long, long long); 46 extern long long __moddi3(long long, long long); 50 47 51 48 extern unsigned int __umodsi3(unsigned int, unsigned int); 52 extern unsigned long __umoddi3(unsigned long, unsigned long); 53 extern unsigned long long __umodti3(unsigned long long, unsigned long long); 49 extern unsigned long long __umoddi3(unsigned long long, unsigned long long); 54 50 55 51 extern int __divmodsi3(int, int, int *); 56 extern long __divmoddi3(long, long, long *); 57 extern long long __divmodti3(long long, long long, long long *); 52 extern unsigned int __udivmodsi3(unsigned int, unsigned int, unsigned int *); 58 53 59 extern unsigned int __udivmodsi3(unsigned int, unsigned int, unsigned int *); 60 extern unsigned long __udivmoddi3(unsigned long, unsigned long, 61 unsigned long *); 62 extern unsigned long long __udivmodti3(unsigned long long, unsigned long long, 54 extern long long __divmoddi3(long long, long long, long long *); 55 extern long long __divmoddi4(long long, long long, long long *); 56 extern unsigned long long __udivmoddi3(unsigned long long, unsigned long long, 63 57 unsigned long long *); 64 65 extern int __divmodsi4(int, int, int *); 66 extern long __divmoddi4(long, long, long *); 67 extern long long __divmodti4(long long, long long, long long *); 68 69 extern unsigned int __udivmodsi4(unsigned int, unsigned int, unsigned int *); 70 extern unsigned long __udivmoddi4(unsigned long, unsigned long, 71 unsigned long *); 72 extern unsigned long long __udivmodti4(unsigned long long, unsigned long long, 58 extern unsigned long long __udivmoddi4(unsigned long long, unsigned long long, 73 59 unsigned long long *); 74 60 -
uspace/lib/softint/include/multiplication.h
r33b8d024 r2467b41 38 38 39 39 /* 64 bit multiplication */ 40 extern long __muldi3(long, long); 41 extern long long __multi3(long long, long long); 40 extern long long __muldi3(long long, long long); 42 41 43 42 #endif -
uspace/lib/softint/include/shift.h
r33b8d024 r2467b41 38 38 39 39 /* Arithmetic/logical shift left. */ 40 extern long __ashldi3(long, int); 41 extern long long __ashlti3(long long, int); 40 extern long long __ashldi3(long long, int); 42 41 43 42 /* Arithmetic shift right. */ 44 extern long __ashrdi3(long, int); 45 extern long long __ashrti3(long long, int); 43 extern long long __ashrdi3(long long, int); 46 44 47 45 /* Logical shift right. */ 48 extern long __lshrdi3(long, int); 49 extern long long __lshrti3(long long, int); 46 extern long long __lshrdi3(long long, int); 50 47 51 48
Note:
See TracChangeset
for help on using the changeset viewer.