Ignore:
Timestamp:
2018-03-02T20:10:49Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f1380b7
Parents:
3061bc1
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
Message:

style: Remove trailing whitespace on _all_ lines, including empty ones, for particular file types.

Command used: tools/srepl '\s\+$' '' -- *.c *.h *.py *.sh *.s *.S *.ag

Currently, whitespace on empty lines is very inconsistent.
There are two basic choices: Either remove the whitespace, or keep empty lines
indented to the level of surrounding code. The former is AFAICT more common,
and also much easier to do automatically.

Alternatively, we could write script for automatic indentation, and use that
instead. However, if such a script exists, it's possible to use the indented
style locally, by having the editor apply relevant conversions on load/save,
without affecting remote repository. IMO, it makes more sense to adopt
the simpler rule.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/softint/generic/division.c

    r3061bc1 ra35b458  
    4545        unsigned int result;
    4646        int steps = sizeof(unsigned int) * 8;
    47        
     47
    4848        *remainder = 0;
    4949        result = 0;
    50        
     50
    5151        if (b == 0) {
    5252                /* FIXME: division by zero */
    5353                return 0;
    5454        }
    55        
     55
    5656        if (a < b) {
    5757                *remainder = a;
    5858                return 0;
    5959        }
    60        
     60
    6161        for (; steps > 0; steps--) {
    6262                /* shift one bit to remainder */
    6363                *remainder = ((*remainder) << 1) | (( a >> 31) & 0x1);
    6464                result <<= 1;
    65                
     65
    6666                if (*remainder >= b) {
    6767                        *remainder -= b;
     
    7070                a <<= 1;
    7171        }
    72        
     72
    7373        return result;
    7474}
     
    7979        unsigned long long result;
    8080        int steps = sizeof(unsigned long long) * 8;
    81        
     81
    8282        *remainder = 0;
    8383        result = 0;
    84        
     84
    8585        if (b == 0) {
    8686                /* FIXME: division by zero */
    8787                return 0;
    8888        }
    89        
     89
    9090        if (a < b) {
    9191                *remainder = a;
    9292                return 0;
    9393        }
    94        
     94
    9595        for (; steps > 0; steps--) {
    9696                /* shift one bit to remainder */
    9797                *remainder = ((*remainder) << 1) | ((a >> 63) & 0x1);
    9898                result <<= 1;
    99                
     99
    100100                if (*remainder >= b) {
    101101                        *remainder -= b;
     
    104104                a <<= 1;
    105105        }
    106        
     106
    107107        return result;
    108108}
     
    113113        unsigned int rem;
    114114        int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem);
    115        
     115
    116116        if (SGN(a) == SGN(b))
    117117                return result;
    118        
     118
    119119        return -result;
    120120}
     
    125125        unsigned long long rem;
    126126        long long result = (long long) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
    127        
     127
    128128        if (SGN(a) == SGN(b))
    129129                return result;
    130        
     130
    131131        return -result;
    132132}
     
    151151        unsigned int rem;
    152152        divandmod32(a, b, &rem);
    153        
     153
    154154        /* if divident is negative, remainder must be too */
    155155        if (!(SGN(a)))
    156156                return -((int) rem);
    157        
     157
    158158        return (int) rem;
    159159}
     
    164164        unsigned long long rem;
    165165        divandmod64(a, b, &rem);
    166        
     166
    167167        /* if divident is negative, remainder must be too */
    168168        if (!(SGN(a)))
    169169                return -((long long) rem);
    170        
     170
    171171        return (long long) rem;
    172172}
     
    192192        unsigned int rem;
    193193        int result = (int) divandmod32(ABSVAL(a), ABSVAL(b), &rem);
    194        
     194
    195195        if (SGN(a) == SGN(b)) {
    196196                *c = rem;
    197197                return result;
    198198        }
    199        
     199
    200200        *c = -rem;
    201201        return -result;
     
    212212        unsigned long long rem;
    213213        long long result = (int) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
    214        
     214
    215215        if (SGN(a) == SGN(b)) {
    216216                *c = rem;
    217217                return result;
    218218        }
    219        
     219
    220220        *c = -rem;
    221221        return -result;
     
    226226        unsigned long long rem;
    227227        long long result = (int) divandmod64(ABSVAL(a), ABSVAL(b), &rem);
    228        
     228
    229229        if (SGN(a) == SGN(b)) {
    230230                *c = rem;
    231231                return result;
    232232        }
    233        
     233
    234234        *c = -rem;
    235235        return -result;
Note: See TracChangeset for help on using the changeset viewer.