summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/softfloat3/source/extF80M_to_ui64_r_minMag.c
blob: bf483903206b7de5249ca33ef79eb2b0aec8c63e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*============================================================================

This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
Package, Release 3e, by John R. Hauser.

Copyright 2011, 2012, 2013, 2014, 2015, 2016 The Regents of the University of
California.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

 1. Redistributions of source code must retain the above copyright notice,
    this list of conditions, and the following disclaimer.

 2. Redistributions in binary form must reproduce the above copyright notice,
    this list of conditions, and the following disclaimer in the documentation
    and/or other materials provided with the distribution.

 3. Neither the name of the University nor the names of its contributors may
    be used to endorse or promote products derived from this software without
    specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS "AS IS", AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE
DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

=============================================================================*/

#include <stdbool.h>
#include <stdint.h>
#include "platform.h"
#include "internals.h"
#include "specialize.h"
#include "softfloat.h"

#ifdef SOFTFLOAT_FAST_INT64

uint_fast64_t extF80M_to_ui64_r_minMag( const extFloat80_t *aPtr, bool exact )
{

    return extF80_to_ui64_r_minMag( *aPtr, exact );

}

#else

uint_fast64_t extF80M_to_ui64_r_minMag( const extFloat80_t *aPtr, bool exact )
{
    const struct extFloat80M *aSPtr;
    uint_fast16_t uiA64;
    int32_t exp;
    uint64_t sig;
    int32_t shiftDist;
    bool sign;
    uint64_t z;

    /*------------------------------------------------------------------------
    *------------------------------------------------------------------------*/
    aSPtr = (const struct extFloat80M *) aPtr;
    uiA64 = aSPtr->signExp;
    exp = expExtF80UI64( uiA64 );
    sig = aSPtr->signif;
    /*------------------------------------------------------------------------
    *------------------------------------------------------------------------*/
    if ( ! sig && (exp != 0x7FFF) ) return 0;
    shiftDist = 0x403E - exp;
    if ( 64 <= shiftDist ) {
        if ( exact ) softfloat_exceptionFlags |= softfloat_flag_inexact;
        return 0;
    }
    /*------------------------------------------------------------------------
    *------------------------------------------------------------------------*/
    sign = signExtF80UI64( uiA64 );
    if ( shiftDist < 0 ) {
        if ( sign || (shiftDist <= -63) ) goto invalid;
        shiftDist = -shiftDist;
        z = sig<<shiftDist;
        if ( z>>shiftDist != sig ) goto invalid;
    } else {
        z = sig;
        if ( shiftDist ) z >>= shiftDist;
        if ( sign && z ) goto invalid;
        if ( exact && shiftDist && (z<<shiftDist != sig) ) {
            softfloat_exceptionFlags |= softfloat_flag_inexact;
        }
    }
    return z;
    /*------------------------------------------------------------------------
    *------------------------------------------------------------------------*/
 invalid:
    softfloat_raiseFlags( softfloat_flag_invalid );
    return
        (exp == 0x7FFF) && (sig & UINT64_C( 0x7FFFFFFFFFFFFFFF ))
            ? ui64_fromNaN
            : sign ? ui64_fromNegOverflow : ui64_fromPosOverflow;

}

#endif
ar.com/avatar/76149e982ea9b87e65b08e77cd940554?s=13&d=retro' /> Vas Crabb5 months mame0271commit 4da96a0c4f... Vas Crabb6 months mame0270commit ef032a31e5... Vas Crabb7 months mame0269commit 6d1970f5f1... Vas Crabb8 months mame0268commit acea8712d6... Vas Crabb9 months mame0267commit 663abae071... Vas Crabb10 months mame0266commit cd7817b220... Vas Crabb11 months mame0265commit f8af5cc2cf... Vas Crabb12 months mame0264commit 5b670ad51f... Vas Crabb13 months mame0263commit 93d8318325... Vas Crabb14 months mame0262commit d48a61f921... Vas Crabb15 months mame0261commit ca50094e8d... Vas Crabb17 months mame0260commit 0a7f1fe9cf... Vas Crabb18 months mame0259commit 4ff20056c3... Vas Crabb19 months mame0258commit 2e0aa82350... Vas Crabb20 months mame0257commit f811a66c53... Vas Crabb21 months mame0256commit b41370db02... Vas Crabb22 months mame0255commit c6650dc072... Vas Crabb23 months mame0254commit bfa8d724a0... Vas Crabb2 years mame0253commit b6d9756c5e... Vas Crabb2 years mame0252commit fb98822c34... Vas Crabb2 years mame0251commit 34e6ec1ef8... Vas Crabb2 years mame0250commit b7cbe74c4b... Vas Crabb2 years mame0249commit 91c5b9ecea... Vas Crabb3 years mame0248commit 2d3d0deec8... Vas Crabb3 years mame0247commit fa2d36c634... Vas Crabb3 years mame0246commit 205b03897c... Vas Crabb3 years mame0245commit 5d31f0fc97... Vas Crabb3 years mame0244commit bcf77373a5... Vas Crabb3 years mame0243commit addbb8ab40... Vas Crabb3 years mame0242commit e8166b5274... Vas Crabb3 years mame0241commit 31f001e501... Vas Crabb3 years mame0240commit f0ab44fe1c... Vas Crabb3 years mame0239commit 80bcaea1ed... Vas Crabb3 years mame0238commit fb21b78904... Vas Crabb3 years mame0237commit 34d8357465... Vas Crabb4 years mame0236commit 5e865af540... Vas Crabb4 years mame0235commit ec9ba6fa76... Vas Crabb4 years mame0234commit 2633c19a68... Vas Crabb4 years mame0233commit 05d0cf61e7... Vas Crabb4 years mame0232commit 2b0f01bc3a... Vas Crabb4 years mame0231commit 1f22113661... Vas Crabb4 years mame0230commit 943c06cba0... Vas Crabb4 years mame0229commit 4322eaae9d... Vas Crabb4 years mame0228commit 140f446933... Vas Crabb4 years mame0227commit d85735634c... Vas Crabb4 years mame0226commit 3c56452b07... Vas Crabb5 years mame0225commit 5a1fd0cc17... Vas Crabb5 years mame0224commit 5892c78a15... Vas Crabb5 years mame0223commit c55a261d26... Vas Crabb5 years mame0222commit 6d50d60a43... Vas Crabb5 years mame0221commit e8a0e0469b... Vas Crabb5 years mame0220commit c5c5723b9d... Vas Crabb5 years mame0219commit 221f006442... Vas Crabb5 years mame0218commit 0e2a252d30... Vas Crabb5 years mame0217commit 13997a8f31... Vas Crabb5 years mame0216commit b8b7c7e232... Vas Crabb5 years mame0215commit e9ef4808dd... Vas Crabb6 years mame0214commit 24d07a12d7... Vas Crabb6 years mame0213commit f7172322a2... Vas Crabb6 years mame0212commit 1182bd9325... Vas Crabb6 years mame0211commit 1b969a8acb... Vas Crabb6 years mame0210commit ad45c9c609... Vas Crabb6 years mame0209commit 2b317bf296... Vas Crabb6 years mame0208commit 9483624864...