artrag Posted February 4, 2021 Share Posted February 4, 2021 I am interested in developing (in intybasic) a general purpose subroutine able to extract a code with a given number of bits from a bitstream of words stored as DATA Something close to this: #bitstream: DATA &1001100110011001,&1001100110011001,&1001100110011001,&1001100110011001,&1001100110011001,..... read_code: procedure ' input: n number of bits to read (from 1 to 16) ' output: #code value of the n bits extracted from the stream ' local variables: #bit_index - starts from 0 and each time you read a code is incremented of n, "pointing" to the current next bit to be extracted ' local constant: #max_bit_index - used to testing against overflow, you cannot read after the end of the bitstream [do the magic] end Does anyone have such a routine already developed and tested and wants to share it? Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.