BitWise split?

  • Thread starter Thread starter Fredrik Melin
  • Start date Start date
F

Fredrik Melin

Hi,

Is there any easy way to split a bitwise value, for sample 127 to an array
into 1, 2, 4, 8, 16, 32, 64?

Regards
Fredrik Melin
 
Frederik,

Better is in my opinion when you found it yourself to change the subject,
now it can look as an addition. However I am glad you sand this of course
and that you found your solution.

Cor
 
Fredrik Melin said:
Is there any easy way to split a bitwise value, for sample 127
to an array into 1, 2, 4, 8, 16, 32, 64?

Why would you "split" 127 to these numbers?
 
Herfried said:
Why would you "split" 127 to these numbers?
bitwise comparison. Alot of flags for API calls work that way.
That way you can pass alot of options with one integer (16 bit
integer=16 options).
 
C-Services Holland b.v. said:
bitwise comparison. Alot of flags for API calls work that way.
That way you can pass alot of options with one integer (16 bit integer=16
options).

Well, I know that, but I was slightly irritated by the "split" in the
subject.
 
Hope this can help you but you need to shift with 128 and you never mention
what data type is your array so I use Integer for the example:

Dim arr(128) As Integer
Dim arr1(128 >> 1) As Integer
Dim arr2(128 >> 2) As Integer
Dim arr3(128 >> 3) As Integer
Dim arr4(128 >> 4) As Integer
Dim arr5(128 >> 5) As Integer
Dim arr6(128 >> 6) As Integer
Dim arr7(128 >> 7) As Integer

chanmm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top