Hello

I have a `pointer` to a memory region containing a binary bitmap array coded in 
LSB <https://en.wikipedia.org/wiki/Bit_numbering> (from right to left) 
completed with the number of expected bools contained in it

for example:
    
    
    byte 1: 00000111
    byte 2: 00000011
    num:    11
    
    
    Run

would mean logic values: 
`[true,true,true,false,false,false,false,false,true,true,false]`

Is it possible to abstract the access to this buffer as an `openArray` without 
performing any copy of the data?

I can successfully get bool value at index `j` with:

`bitand(toOpenArray(cast[ptr UncheckedArray[byte]](myPointer), 0, num-1)[j div 
8], (1 shl (j mod 8)).byte).bool`

But I'm failing to generate or understanding if it's really possible or not to 
write the template that would have signature:

`template bitmapBufferAsOpenArray(a: pointer): openArray[bool] =`

thanks

Reply via email to