mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[liba] Add __aeabi_ul2d implementation
This commit is contained in:
committed by
EmilieNumworks
parent
a8dc17a6cf
commit
90a75a320b
@@ -187,4 +187,5 @@ objs += $(addprefix liba/src/external/softfloat/src/, \
|
||||
s_subMagsF64.o \
|
||||
softfloat_state.o \
|
||||
ui32_to_f64.o \
|
||||
ui64_to_f64.o \
|
||||
)
|
||||
|
||||
@@ -12,6 +12,10 @@ aeabi_double_t __aeabi_l2d(int64_t i) {
|
||||
return d(i64_to_f64(i));
|
||||
}
|
||||
|
||||
aeabi_float_t __aeabi_ul2d(uint64_t i) {
|
||||
return d(ui64_to_f64(i));
|
||||
}
|
||||
|
||||
int64_t __aeabi_f2lz(aeabi_float_t x) {
|
||||
return f32_to_i64_r_minMag(f32(x), 0);
|
||||
}
|
||||
|
||||
1
liba/src/external/softfloat/port/softfloat.h
vendored
1
liba/src/external/softfloat/port/softfloat.h
vendored
@@ -14,6 +14,7 @@ float32_t f64_to_f32(float64_t x);
|
||||
float64_t f32_to_f64(float32_t x);
|
||||
float64_t i32_to_f64(int32_t i);
|
||||
float64_t ui32_to_f64(uint32_t i);
|
||||
float64_t ui64_to_f64(uint64_t i);
|
||||
int_fast32_t f64_to_i32_r_minMag(float64_t x, bool exact);
|
||||
bool f64_eq(float64_t x, float64_t y);
|
||||
bool f64_le(float64_t x, float64_t y);
|
||||
|
||||
59
liba/src/external/softfloat/src/ui64_to_f64.c
vendored
Normal file
59
liba/src/external/softfloat/src/ui64_to_f64.c
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
|
||||
/*============================================================================
|
||||
|
||||
This C source file is part of the SoftFloat IEEE Floating-Point Arithmetic
|
||||
Package, Release 3c, by John R. Hauser.
|
||||
|
||||
Copyright 2011, 2012, 2013, 2014 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 <stdint.h>
|
||||
#include "platform.h"
|
||||
#include "internals.h"
|
||||
#include "softfloat.h"
|
||||
|
||||
float64_t ui64_to_f64( uint64_t a )
|
||||
{
|
||||
union ui64_f64 uZ;
|
||||
|
||||
if ( ! a ) {
|
||||
uZ.ui = 0;
|
||||
return uZ.f;
|
||||
}
|
||||
if ( a & UINT64_C( 0x8000000000000000 ) ) {
|
||||
return
|
||||
softfloat_roundPackToF64(
|
||||
0, 0x43D, softfloat_shortShiftRightJam64( a, 1 ) );
|
||||
} else {
|
||||
return softfloat_normRoundPackToF64( 0, 0x43C, a );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user