468,513 Members | 984 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,513 developers. It's quick & easy.

Split a vector

Please, I have a verctor of 64 bits like this Y = 00000000 1111000 0110011 0010101 0101111 0101010 1011001 1001111 0001111, and I want to split it in two vectors (each one of 28 bits) like this:

F1 = Y(8 to 35); I mean This vector is from bit 8 to bit 35, reading Y from left to right, you know bit 1 is 0, 2 is 0 and 64 is 1

F2 = Y(36 to 64); so the vector would be;

F1 = 1111000 0110011 0010101 0101111 ;
F2 = 0101010 1011001 1001111 0001111;

Thanks for your help.
Aug 16 '06 #1
1 3572
Banfa
9,056 Expert Mod 8TB
Just use bit arimthmatic to get out the bits you want.

Normally when talking about bits it is usual for the least significant bit to be bit 0 (so a 32 bit number would have bits 0 - 31) and the most significant bit to appear on the left (as we do in decimal) and writing out binary numbers it is normal to group the bits in bytes (i.e. 8 bits per group) not 8 bits in the first group and seven there after.



F1 = (Y >> 28) & 0x000000000FFFFFFF
F1 = Y & 0x000000000FFFFFFF
Aug 16 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by alexk | last post: by
15 posts views Thread by zealotcat | last post: by
4 posts views Thread by Daniel Pomrehn | last post: by
11 posts views Thread by | last post: by
8 posts views Thread by Ross A. Finlayson | last post: by
1 post views Thread by Sam Johnson | last post: by
5 posts views Thread by PengYu.UT | last post: by
mickey0
5 posts views Thread by mickey0 | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.