Changeset 90924df in mainline for boot/genarch/src/division.c


Ignore:
Timestamp:
2012-04-08T12:08:49Z (12 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f2b3d3e
Parents:
d9f53877 (diff), f3378ba (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • boot/genarch/src/division.c

    rd9f53877 r90924df  
    7373{
    7474        unsigned long long result;
    75         int steps = sizeof(unsigned long long) * 8; 
     75        int steps = sizeof(unsigned long long) * 8;
    7676       
    7777        *remainder = 0;
     
    104104
    105105/* 32bit integer division */
    106 int __divsi3(int a, int b) 
     106int __divsi3(int a, int b)
    107107{
    108108        unsigned int rem;
     
    116116
    117117/* 64bit integer division */
    118 long long __divdi3(long long a, long long b) 
     118long long __divdi3(long long a, long long b)
    119119{
    120120        unsigned long long rem;
     
    155155
    156156/* 64bit remainder of the signed division */
    157 long long __moddi3(long long a,long long b)
     157long long __moddi3(long long a, long long b)
    158158{
    159159        unsigned long long rem;
     
    183183}
    184184
     185int __divmodsi3(int a, int b, int *c)
     186{
     187        unsigned int rem;
     188        int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem);
     189       
     190        if (SGN(a) == SGN(b)) {
     191                *c = rem;
     192                return result;
     193        }
     194       
     195        *c = -rem;
     196        return -result;
     197}
     198
     199unsigned int __udivmodsi3(unsigned int a, unsigned int b,
     200    unsigned int *c)
     201{
     202        return divandmod32(a, b, c);
     203}
     204
     205long long __divmoddi3(long long a, long long b, long long *c)
     206{
     207        unsigned long long rem;
     208        long long result = (int) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
     209       
     210        if (SGN(a) == SGN(b)) {
     211                *c = rem;
     212                return result;
     213        }
     214       
     215        *c = -rem;
     216        return -result;
     217}
     218
    185219unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b,
    186220    unsigned long long *c)
Note: See TracChangeset for help on using the changeset viewer.