Skip to content

Commit

Permalink
reset hex align 2 times for bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
katsyoshi committed Oct 17, 2023
1 parent e26363a commit 0b488d4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/vaporware/compiler/assembler/elf/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def set! = (raise Vaporware::Compiler::Assembler::ELF::Error, "should be impleme
private
def align(val, bytes) = (val << 0 until val.size % bytes == 0)
def bytes = (raise Vaporware::Compiler::Assembler::ELF::Error, "should be implement this class")
def num2bytes(val, bytes) = bites(val, bytes*2).reverse
def check(val, bytes) = ((val.is_a?(Array) && val.all? { |v| v.is_a?(Integer) } && val.size == bytes) || (val.is_a?(Integer) && (bites(val, byte*2).size == bytes))
def hexes(val, hex) = ("%0#{hex}x" % val).split(/.{1,#{hex}/).map { |v| v.to_i(16) }
def num2bytes(val, bytes) = hexas(val, bytes*2).reverse
def check(val, bytes) = ((val.is_a?(Array) && val.all? { |v| v.is_a?(Integer) } && val.size == bytes) || (val.is_a?(Integer) && (hexas(val, byte*2).size == bytes))
def hexas(val, hex) = ("%0#{hex}x" % val).split(/.{1,2/).map { |v| v.to_i(16) }
end

0 comments on commit 0b488d4

Please sign in to comment.