Changeset 280a27e in mainline for genarch/src/softint/division.c


Ignore:
Timestamp:
2006-04-16T13:16:44Z (19 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50de918
Parents:
c624b96
Message:

Printf ported back from uspace to kernel.
Printf calls changed to match new conventions.

File:
1 edited

Legend:

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

    rc624b96 r280a27e  
    6666
    6767
    68 static unsigned long divandmod64(unsigned long a, unsigned long b, unsigned long *remainder)
     68static unsigned long long divandmod64(unsigned long long a, unsigned long long b, unsigned long long *remainder)
    6969{
    70         unsigned long result;
    71         int steps = sizeof(unsigned long) * 8;
     70        unsigned long long result;
     71        int steps = sizeof(unsigned long long) * 8;
    7272       
    7373        *remainder = 0;
     
    112112
    113113/* 64bit integer division */
    114 long __divdi3(long a, long b)
     114long long __divdi3(long long a, long long b)
    115115{
    116         unsigned long rem;
    117         long result;
     116        unsigned long long rem;
     117        long long result;
    118118       
    119         result = (long)divandmod64(ABSVAL(a), ABSVAL(b), &rem);
     119        result = (long long)divandmod64(ABSVAL(a), ABSVAL(b), &rem);
    120120
    121121        if ( SGN(a) == SGN(b)) return result;
     
    131131
    132132/* 64bit unsigned integer division */
    133 unsigned long __udivdi3(unsigned long a, unsigned long b)
     133unsigned long long __udivdi3(unsigned long long a, unsigned long long b)
    134134{
    135         unsigned long rem;
     135        unsigned long long  rem;
    136136        return divandmod64(a, b, &rem);
    137137}
     
    152152
    153153/* 64bit remainder of the signed division */
    154 long __moddi3(long a, long b)
     154long long __moddi3(long long a,long long b)
    155155{
    156         unsigned long rem;
     156        unsigned long long rem;
    157157        divandmod64(a, b, &rem);
    158158       
    159159        /* if divident is negative, remainder must be too */
    160160        if (!(SGN(a))) {
    161                 return -((long)rem);
     161                return -((long long)rem);
    162162        }
    163163       
    164         return (long)rem;
     164        return (long long)rem;
    165165}
    166166
     
    174174
    175175/* 64bit remainder of the unsigned division */
    176 unsigned long __umoddi3(unsigned long a, unsigned long b)
     176unsigned long long __umoddi3(unsigned long long a, unsigned long long b)
    177177{
    178         unsigned long rem;
     178        unsigned long long rem;
    179179        divandmod64(a, b, &rem);
    180180        return rem;
    181181}
    182182
    183 unsigned long __udivmoddi3(unsigned long a, unsigned long b, unsigned long *c)
     183unsigned long long __udivmoddi3(unsigned long long a, unsigned long long b, unsigned long long *c)
    184184{
    185185        return divandmod64(a, b, c);
Note: See TracChangeset for help on using the changeset viewer.