Created
October 30, 2019 02:47
-
-
Save msakai/4deae725a7f065b98706483f1ccb693f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print(0x10000000000000000 is 0x10000000000000000) | |
#=> True | |
import dis | |
b = dis.Bytecode(lambda: 0x10000000000000000 is 0x10000000000000000) | |
print(b.dis()) | |
#=> | |
# 4 0 LOAD_CONST 1 (18446744073709551616) | |
# 2 LOAD_CONST 1 (18446744073709551616) | |
# 4 COMPARE_OP 8 (is) | |
# 6 RETURN_VALUE | |
print(b.info()) | |
#=> | |
# Name: <lambda> | |
# Filename: int_object.py | |
# Argument count: 0 | |
# Kw-only arguments: 0 | |
# Number of locals: 0 | |
# Stack size: 2 | |
# Flags: OPTIMIZED, NEWLOCALS, NOFREE | |
# Constants: | |
# 0: None | |
# 1: 18446744073709551616 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p(0x10000000000000000.equal? 0x10000000000000000) | |
# => false | |
puts RubyVM::InstructionSequence.compile("0x10000000000000000.equal? 0x10000000000000000").disasm | |
# => | |
# == disasm: #<ISeq:<compiled>@<compiled>:1 (1,0)-(1,46)>================= | |
# 0000 putobject 18446744073709551616 ( 1)[Li] | |
# 0002 putobject 18446744073709551616 | |
# 0004 opt_send_without_block <callinfo!mid:equal?, argc:1, ARGS_SIMPLE>, <callcache> | |
# 0007 leave |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment