Project

General

Profile

Actions

Feature #8568

closed

Introduce RbConfig value for native word size, to avoid Fixnum#size use

Added by headius (Charles Nutter) almost 11 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:55638]

Description

Fixnum#size is not really useful to represent native word size across all platforms and implementations. On JRuby, for example, our Fixnum is always represented as a 64-bit Java "long" value, regardless of the underlying native platform. There may be other implementations that fix Fixnum's size to a specific bit width as well. Therefore, using Fixnum#size to determine the size of a word on the underlying native platform is not reliable.

I propose two additions to Ruby:

  1. RbConfig value "word_size" for native word size. This could reflect bit size (32, 64) or byte size (4, 8).

  2. A constant, somewhere in Ruby, to provide access to this value more directly. I'm not sure where this should go. ObjectSpace::WORD_SIZE?


Files

sizeof.diff (2.11 KB) sizeof.diff nobu (Nobuyoshi Nakada), 07/03/2013 04:56 PM

Related issues 1 (0 open1 closed)

Related to Ruby master - Feature #8553: Bignum#size (and Fixnum#size)Closed06/21/201308/31/2013Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0