From 8f2921e115327250b47a9871ec2107531118d205 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Fri, 27 Oct 2023 10:40:46 +0900 Subject: [PATCH] Add `ddress` to Fiddely::MemoryPointer Related to (#73) by @nwxxb Thanks! --- lib/gr_commons/fiddley.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/gr_commons/fiddley.rb b/lib/gr_commons/fiddley.rb index 8234aee7..6c8383b2 100644 --- a/lib/gr_commons/fiddley.rb +++ b/lib/gr_commons/fiddley.rb @@ -198,6 +198,10 @@ def to_ptr @ptr end + def address + @ptr.to_i + end + { 8 => 'c', 16 => 's', 32 => 'l', 64 => 'q' }.each do |bits, form| bytes = bits / 8