I
Isliguezze
Hi. There's a task of splitting an int into three unsigned char's.
There's also one limitation. The maximum size of the given int is
10^9, what's enough to code with as small as 17 bits. So, what is the
problem? How to split a maximum 17 value bits containing int into 3
unsigned chars(8+8+1, 6 bits)? The problem is that I can't use
unsigned char pointer, to point on int like this:
unsigned char *uchp;
unsigned int i = 1000000000;
uchp = &i;
for (int j = 0; j < sizeof(int); ++j)
cout << *uchp;
to point on each byte of int... What can be performed in assembler
using BYTE PTR, architecture is Intel x86. But how to split int into
three unsigned chars using C++?
There's also one limitation. The maximum size of the given int is
10^9, what's enough to code with as small as 17 bits. So, what is the
problem? How to split a maximum 17 value bits containing int into 3
unsigned chars(8+8+1, 6 bits)? The problem is that I can't use
unsigned char pointer, to point on int like this:
unsigned char *uchp;
unsigned int i = 1000000000;
uchp = &i;
for (int j = 0; j < sizeof(int); ++j)
cout << *uchp;
to point on each byte of int... What can be performed in assembler
using BYTE PTR, architecture is Intel x86. But how to split int into
three unsigned chars using C++?