move float128 definition to different include file to reduce #include dependencies

This commit is contained in:
Stanislav Shwartsman 2024-04-24 22:52:40 +03:00
parent c21a2d616f
commit 0c12c4fd83
17 changed files with 26 additions and 31 deletions

View File

@ -36,19 +36,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef primitiveTypes_h
#define primitiveTypes_h 1
#include <stdint.h>
#include "config.h"
#ifdef BX_LITTLE_ENDIAN
struct uint128 { uint64_t v0, v64; };
struct uint64_extra { uint64_t extra, v; };
struct uint128_extra { uint64_t extra; struct uint128 v; };
#else
struct uint128 { uint64_t v64, v0; };
struct uint64_extra { uint64_t v, extra; };
struct uint128_extra { struct uint128 v; uint64_t extra; };
#endif
/*----------------------------------------------------------------------------
| These macros are used to isolate the differences in word order between big-
| endian and little-endian platforms.

View File

@ -39,7 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdbool.h>
#include <stdint.h>
#include "config.h"
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_shortShiftRightJam64
/*----------------------------------------------------------------------------

View File

@ -39,13 +39,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <stdint.h>
#include "config.h"
#ifdef BX_LITTLE_ENDIAN
struct uint128 { uint64_t v0, v64; };
struct uint64_extra { uint64_t extra, v; };
struct uint128_extra { uint64_t extra; struct uint128 v; };
#else
struct uint128 { uint64_t v64, v0; };
struct uint64_extra { uint64_t v, extra; };
struct uint128_extra { struct uint128 v; uint64_t extra; };
#endif
/*----------------------------------------------------------------------------
| Types used to pass 16-bit, 32-bit, 64-bit, and 128-bit floating-point
| arguments and results to/from functions. These types must be exactly
| 16 bits, 32 bits, 64 bits, and 128 bits in size, respectively. Where a
| platform has "native" support for IEEE-Standard floating-point formats,
| the types below may, if desired, be defined as aliases for the native types
| (typically 'float' and 'double', and possibly 'long double').
| 16 bits, 32 bits, 64 bits, and 128 bits in size, respectively.
*----------------------------------------------------------------------------*/
typedef struct f16_t {
uint16_t v;
@ -65,8 +72,6 @@ typedef struct f64_t {
operator uint64_t() const { return v; }
} float64_t;
#include "primitiveTypes.h"
typedef uint128 float128_t;
/*----------------------------------------------------------------------------

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_add128

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_mul128By32

View File

@ -39,6 +39,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define softfloat_mul128To256M softfloat_mul128To256M
#include "primitives.h"
#include "primitiveTypes.h"
void
softfloat_mul128To256M(uint64_t a64, uint64_t a0, uint64_t b64, uint64_t b0, uint64_t *zPtr)

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_mul64ByShifted32To128

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_mul64To128

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_shiftRightJam128

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_shiftRightJam128Extra

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_shiftRightJam64Extra

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_shortShiftLeft128

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_shortShiftRight128

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_shortShiftRightJam128

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_shortShiftRightJam128Extra

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_shortShiftRightJam64Extra

View File

@ -34,7 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <stdint.h>
#include "primitiveTypes.h"
#include "softfloat_types.h"
#ifndef softfloat_sub128