implement byte access for some word

wouldn’t have been possible without the ruby version
This commit is contained in:
Torsten Ruger
2015-11-11 20:36:07 +02:00
parent 9bfc9cf6c2
commit 1e7935bf85
3 changed files with 58 additions and 12 deletions

View File

@ -94,7 +94,9 @@ module Parfait
shifted = char << (rest * 8)
was = get_internal( word_index )
was = 0 unless was.is_a?(Numeric)
masked = was & [ 0xFFFFFF00 , 0xFFFF00FF , 0xFF00FFFF , 0x00FFFFFF ][rest]
mask = 0xFF << (rest * 8)
mask = 0xFFFFFFFF - mask
masked = was & mask
put = masked + shifted
set_internal( word_index , put )
msg = "set index=#{index} word_index=#{word_index} rest=#{rest}= "