المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Converting Bits value into integer



C# Programming
05-12-2009, 11:32 AM
Dear Friends.
I need to convert Byte value into integer.
ie. for example

Input =7

1. Mark 7th Bit as 1
7 6 5 4 3 2 1 0 (8 Bit)
1 0 0 0 0 0 0 0

2. Split into 2 by 4 bit
7 6 5 4 | 3 2 1 0 (8 Bit)
1 0 0 0 | 0 0 0 0
part 1 | part 2

3. Use 8 4 2 1 logic and apply it

4. part 1 = 8
Part 2 =0

5. Output is 80