ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
From: nobu@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:84941] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits
Date: Sat, 20 Jan 2018 11:08:00 +0000 (UTC)	[thread overview]
Message-ID: <redmine.journal-69650.20180120110759.e8ad9b1a9efadb57@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-14378.20180120102459@ruby-lang.org

Issue #14378 has been updated by nobu (Nobuyoshi Nakada).

Description updated

HfCloud (Xiangyu Shi) wrote:
> So, it is that FIXNUM of the 64-bits ruby is a 32-bits data?

Yes, we are using `long` for fixnums, and Windows is the so-called IL32LLP64 platform.
To "fix" this, or relax this limitation, we have to replace tons of `long` in the source code.


----------------------------------------
Bug #14378: On windows, RUBY_FIXNUM_MAX of 64 bits ruby  is 32 bits
https://bugs.ruby-lang.org/issues/14378#change-69650

* Author: HfCloud (Xiangyu Shi)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.5.0
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
On windows, start an IRB of a 64-bits ruby, enter these code:

~~~ruby
(1<<29).equal?(1<<29) 
#=>true

(1<<30).equal?(1<<30)
#=>false
~~~

So, it is that FIXNUM of the 64-bits ruby is a 32-bits data?
But my friend try these code on linux platform and all got true(it means FIXNUM is 64bits) 
Then I opened ruby/ruby.h and found this:

~~~ ruby
#define RUBY_FIXNUM_MAX (LONG_MAX>>1)
~~~

The LONG_MAX of my compiler(msvc140, vs2017) is 2147483647, and the ruby which is installed by ruby-installer also have the same problem.





-- 
https://bugs.ruby-lang.org/

  parent reply	other threads:[~2018-01-20 11:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <redmine.issue-14378.20180120102459@ruby-lang.org>
2018-01-20 10:25 ` [ruby-core:84940] [Ruby trunk Bug#14378] On windows, RUBY_FIXNUM_MAX of 64 bits ruby is 32 bits sxysxygm
2018-01-20 11:08 ` nobu [this message]
2018-01-20 11:29 ` [ruby-core:84942] " sxysxygm
2018-01-20 12:01 ` [ruby-core:84945] " sxysxygm
2018-01-21  0:15   ` [ruby-core:84954] " Bill Kelly
2018-01-21  6:48     ` [ruby-core:84955] " Bill Kelly
2018-01-20 14:22 ` [ruby-core:84947] " eregontp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.ruby-lang.org/en/community/mailing-lists/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=redmine.journal-69650.20180120110759.e8ad9b1a9efadb57@ruby-lang.org \
    --to=ruby-core@ruby-lang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).