class Ronin::Support::Binary::Stack

Represents a stack that can have binary data pushed to or popped from it.

## Features

## Examples

Creating a new stack:

stack = Binary::Stack.new
# => #<Ronin::Support::Binary::Stack: "">
stack.push 0x41414141
# => #<Ronin::Support::Binary::Stack: "AAAA\x00\x00\x00\x00">
stack.push 0x7fffffffdde0
# => #<Ronin::Support::Binary::Stack: "\xE0\xDD\xFF\xFF\xFF\x7F\x00\x00AAAA\x00\x00\x00\x00">
stack.push -1
# => #<Ronin::Support::Binary::Stack: "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xE0\xDD\xFF\xFF\xFF\x7F\x00\x00AAAA\x00\x00\x00\x00">
stack.to_s
# => => "\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xFF\xE0\xDD\xFF\xFF\xFF\x7F\x00\x00AAAA\x00\x00\x00\x00"

Creating a stack from an existing String:

stack = Binary::Stack.new("\x41\x00\x00\x00\x00\x00\x00\x00\x42\x00\x00\x00\x00\x00\x00\x00")
stack[0]
# => 65
stack[8]
# => 66

Negative indexing within the stack:

stack.push(65)
stack.push(66)
stack[-8]
# => 65
stack[-16]
# => 66

Note: negative indexes are treated relative to the beginning of the stack, since stacks grow downward in the address space.

@api public

@since 1.0.0