Changeset 1b20da0 in mainline for kernel/genarch/src/softint
- Timestamp:
- 2018-02-28T17:52:03Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3061bc1
- Parents:
- df6ded8
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
- Location:
- kernel/genarch/src/softint
- Files:
-
- 2 edited
-
division.c (modified) (1 diff)
-
multiplication.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/softint/division.c
rdf6ded8 r1b20da0 42 42 { 43 43 unsigned int result; 44 int steps = sizeof(unsigned int) * 8; 44 int steps = sizeof(unsigned int) * 8; 45 45 46 46 *remainder = 0; -
kernel/genarch/src/softint/multiplication.c
rdf6ded8 r1b20da0 48 48 49 49 /** 50 * Multiply two integers and return long long as result. 50 * Multiply two integers and return long long as result. 51 51 * This function is overflow safe. 52 52 * @param a … … 56 56 static unsigned long long mul(unsigned int a, unsigned int b) { 57 57 unsigned int a1, a2, b1, b2; 58 unsigned long long t1, t2, t3; 58 unsigned long long t1, t2, t3; 59 59 60 60 a1 = a >> 16; … … 68 68 t3 = a2*b2; 69 69 70 t3 = (((t1 << 16) + t2) << 16) + t3; 70 t3 = (((t1 << 16) + t2) << 16) + t3; 71 71 72 72 return t3; … … 105 105 106 106 // (if OF checked) a1 or b1 is zero => result fits in 64 bits, no need to another overflow check 107 t1 = mul(a1,b2) + mul(b1,a2); 107 t1 = mul(a1,b2) + mul(b1,a2); 108 108 109 109 if (SOFTINT_CHECK_OF && t1 > MAX_UINT32) {
Note:
See TracChangeset
for help on using the changeset viewer.
