Changeset a35b458 in mainline for uspace/app/tester/float/softfloat1.c


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/app/tester/float/softfloat1.c

    r3061bc1 ra35b458  
    100100        if (a < b)
    101101                return -1;
    102        
     102
    103103        if (a > b)
    104104                return 1;
    105        
     105
    106106        return 0;
    107107}
     
    111111        if (a < b)
    112112                return -1;
    113        
     113
    114114        if (a > b)
    115115                return 1;
    116        
     116
    117117        return 0;
    118118}
     
    122122{
    123123        uint_to_double_op_t op = (uint_to_double_op_t) f;
    124        
     124
    125125        double c;
    126126        double sc;
    127127        op(uop_a[i], &c, &sc);
    128        
     128
    129129        *pic = (cmptype_t) (c * PRECISION);
    130130        *pisc = (cmptype_t) (sc * PRECISION);
     
    135135{
    136136        double_to_uint_op_t op = (double_to_uint_op_t) f;
    137        
     137
    138138        unsigned int c;
    139139        unsigned int sc;
    140140        op(dop_a[i], &c, &sc);
    141        
     141
    142142        *pic = (cmptype_t) c;
    143143        *pisc = (cmptype_t) sc;
     
    148148{
    149149        float_binary_op_t op = (float_binary_op_t) f;
    150        
     150
    151151        float c;
    152152        float sc;
    153153        op(fop_a[i], fop_a[j], &c, &sc);
    154        
     154
    155155        *pic = (cmptype_t) (c * PRECISION);
    156156        *pisc = (cmptype_t) (sc * PRECISION);
     
    161161{
    162162        float_cmp_op_t op = (float_cmp_op_t) f;
    163        
     163
    164164        op(dop_a[i], dop_a[j], pis, piss);
    165165}
     
    169169{
    170170        double_binary_op_t op = (double_binary_op_t) f;
    171        
     171
    172172        double c;
    173173        double sc;
    174174        op(dop_a[i], dop_a[j], &c, &sc);
    175        
     175
    176176        *pic = (cmptype_t) (c * PRECISION);
    177177        *pisc = (cmptype_t) (sc * PRECISION);
     
    182182{
    183183        double_cmp_op_t op = (double_cmp_op_t) f;
    184        
     184
    185185        op(dop_a[i], dop_a[j], pis, piss);
    186186}
     
    189189{
    190190        bool correct = true;
    191        
     191
    192192        for (unsigned int i = 0; i < OPERANDS; i++) {
    193193                cmptype_t ic;
    194194                cmptype_t isc;
    195                
     195
    196196                template(f, i, &ic, &isc);
    197197                cmptype_t diff = ic - isc;
    198                
     198
    199199                if (diff != 0) {
    200200                        TPRINTF("i=%u ic=%" PRIdCMPTYPE " isc=%" PRIdCMPTYPE "\n",
     
    203203                }
    204204        }
    205        
     205
    206206        return correct;
    207207}
     
    210210{
    211211        bool correct = true;
    212        
     212
    213213        for (unsigned int i = 0; i < OPERANDS; i++) {
    214214                for (unsigned int j = 0; j < OPERANDS; j++) {
    215215                        cmptype_t ic;
    216216                        cmptype_t isc;
    217                        
     217
    218218                        template(f, i, j, &ic, &isc);
    219219                        cmptype_t diff = ic - isc;
    220                        
     220
    221221                        if (diff != 0) {
    222222                                TPRINTF("i=%u, j=%u ic=%" PRIdCMPTYPE
     
    226226                }
    227227        }
    228        
     228
    229229        return correct;
    230230}
     
    275275                return;
    276276        }
    277        
     277
    278278        *pc = a / b;
    279279        *psc = div_float(a, b);
     
    284284{
    285285        *pis = fcmp(a, b);
    286        
     286
    287287        if (is_float_lt(a, b) == -1)
    288288                *piss = -1;
     
    320320                return;
    321321        }
    322        
     322
    323323        *pc = a / b;
    324324        *psc = div_double(a, b);
     
    329329{
    330330        *pis = dcmp(a, b);
    331        
     331
    332332        if (is_double_lt(a, b) == -1)
    333333                *piss = -1;
     
    343343{
    344344        bool err = false;
    345        
     345
    346346        if (!test_template_binary(float_template_binary, float_add_operator)) {
    347347                err = true;
    348348                TPRINTF("%s\n", "Float addition failed");
    349349        }
    350        
     350
    351351        if (!test_template_binary(float_template_binary, float_sub_operator)) {
    352352                err = true;
    353353                TPRINTF("%s\n", "Float addition failed");
    354354        }
    355        
     355
    356356        if (!test_template_binary(float_template_binary, float_mul_operator)) {
    357357                err = true;
    358358                TPRINTF("%s\n", "Float multiplication failed");
    359359        }
    360        
     360
    361361        if (!test_template_binary(float_template_binary, float_div_operator)) {
    362362                err = true;
    363363                TPRINTF("%s\n", "Float division failed");
    364364        }
    365        
     365
    366366        if (!test_template_binary(float_compare_template, float_cmp_operator)) {
    367367                err = true;
    368368                TPRINTF("%s\n", "Float comparison failed");
    369369        }
    370        
     370
    371371        if (!test_template_binary(double_template_binary, double_add_operator)) {
    372372                err = true;
    373373                TPRINTF("%s\n", "Double addition failed");
    374374        }
    375        
     375
    376376        if (!test_template_binary(double_template_binary, double_sub_operator)) {
    377377                err = true;
    378378                TPRINTF("%s\n", "Double addition failed");
    379379        }
    380        
     380
    381381        if (!test_template_binary(double_template_binary, double_mul_operator)) {
    382382                err = true;
    383383                TPRINTF("%s\n", "Double multiplication failed");
    384384        }
    385        
     385
    386386        if (!test_template_binary(double_template_binary, double_div_operator)) {
    387387                err = true;
    388388                TPRINTF("%s\n", "Double division failed");
    389389        }
    390        
     390
    391391        if (!test_template_binary(double_compare_template, double_cmp_operator)) {
    392392                err = true;
    393393                TPRINTF("%s\n", "Double comparison failed");
    394394        }
    395        
     395
    396396        if (!test_template_unary(uint_to_double_template,
    397397            uint_to_double_operator)) {
     
    399399                TPRINTF("%s\n", "Conversion from unsigned int to double failed");
    400400        }
    401        
     401
    402402        if (!test_template_unary(double_to_uint_template,
    403403            double_to_uint_operator)) {
     
    405405                TPRINTF("%s\n", "Conversion from double to unsigned int failed");
    406406        }
    407        
     407
    408408        if (!test_template_unary(double_to_uint_template,
    409409            double_to_int_operator)) {
     
    411411                TPRINTF("%s\n", "Conversion from double to signed int failed");
    412412        }
    413        
     413
    414414        if (err)
    415415                return "Software floating point imprecision";
    416        
     416
    417417        return NULL;
    418418}
Note: See TracChangeset for help on using the changeset viewer.