mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 19:50:24 +02:00
Slim heap-allocated flonums
* libguile/numbers.h (struct scm_t_double, struct scm_t_complex): Avoid adding an extra padding word on systems with 8-byte pointers. * module/system/base/types.scm (cell->object): Update to compute correct offset of embedded double.
This commit is contained in:
parent
b9f7621e13
commit
41689edfc3
2 changed files with 7 additions and 3 deletions
|
@ -4,7 +4,7 @@
|
||||||
#define SCM_NUMBERS_H
|
#define SCM_NUMBERS_H
|
||||||
|
|
||||||
/* Copyright (C) 1995, 1996, 1998, 2000-2006, 2008-2011, 2013, 2014,
|
/* Copyright (C) 1995, 1996, 1998, 2000-2006, 2008-2011, 2013, 2014,
|
||||||
* 2016, 2017 Free Software Foundation, Inc.
|
* 2016-2018 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public License
|
* modify it under the terms of the GNU Lesser General Public License
|
||||||
|
@ -172,14 +172,18 @@ typedef long scm_t_inum;
|
||||||
typedef struct scm_t_double
|
typedef struct scm_t_double
|
||||||
{
|
{
|
||||||
SCM type;
|
SCM type;
|
||||||
|
#if SCM_SIZEOF_UINTPTR_T != 8
|
||||||
SCM pad;
|
SCM pad;
|
||||||
|
#endif
|
||||||
double real;
|
double real;
|
||||||
} scm_t_double;
|
} scm_t_double;
|
||||||
|
|
||||||
typedef struct scm_t_complex
|
typedef struct scm_t_complex
|
||||||
{
|
{
|
||||||
SCM type;
|
SCM type;
|
||||||
|
#if SCM_SIZEOF_UINTPTR_T != 8
|
||||||
SCM pad;
|
SCM pad;
|
||||||
|
#endif
|
||||||
double real;
|
double real;
|
||||||
double imag;
|
double imag;
|
||||||
} scm_t_complex;
|
} scm_t_complex;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;;; 'SCM' type tag decoding.
|
;;; 'SCM' type tag decoding.
|
||||||
;;; Copyright (C) 2014, 2015, 2017 Free Software Foundation, Inc.
|
;;; Copyright (C) 2014, 2015, 2017, 2018 Free Software Foundation, Inc.
|
||||||
;;;
|
;;;
|
||||||
;;; This library is free software; you can redistribute it and/or modify it
|
;;; This library is free software; you can redistribute it and/or modify it
|
||||||
;;; under the terms of the GNU Lesser General Public License as published by
|
;;; under the terms of the GNU Lesser General Public License as published by
|
||||||
|
@ -419,7 +419,7 @@ using BACKEND."
|
||||||
(((_ & #xffff = %tc16-bignum))
|
(((_ & #xffff = %tc16-bignum))
|
||||||
(inferior-object 'bignum address))
|
(inferior-object 'bignum address))
|
||||||
(((_ & #xffff = %tc16-flonum) pad)
|
(((_ & #xffff = %tc16-flonum) pad)
|
||||||
(let* ((address (+ address (* 2 %word-size)))
|
(let* ((address (+ address (match %word-size (4 8) (8 8))))
|
||||||
(port (memory-port backend address (sizeof double)))
|
(port (memory-port backend address (sizeof double)))
|
||||||
(words (get-bytevector-n port (sizeof double))))
|
(words (get-bytevector-n port (sizeof double))))
|
||||||
(bytevector-ieee-double-ref words 0 (native-endianness))))
|
(bytevector-ieee-double-ref words 0 (native-endianness))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue