# Variable type while creating a block

Hello

If i set the input of my block as a byte, means that the block will
handle 8
bits at a time and each item correspond to one bit of that byte?

in[0] is the first bit and so on?

Thank you.

View this message in context:
Sent from the GnuRadio mailing list archive at Nabble.com.

On Tue, Jun 16, 2015 at 2:17 PM, Marbellys
[email protected]
wrote:

If i set the input of my block as a byte, means that the block will handle
8
bits at a time and each item correspond to one bit of that byte?

in[0] is the first bit and so on?

No, this isn’t automatic. You would also have to precede your block
with a
block like gr::blocks::unpack_k_bits_bb or ::repack_k_bits_bb to
generate
such a stream from a packed byte format.

Thank you, Johnathan.

So if i use an unpack_k_bits block, and i set k to 1, will I be handle
1
bit at a time?

View this message in context:
Sent from the GnuRadio mailing list archive at Nabble.com.

On Tue, Jun 16, 2015 at 4:13 PM, Marbellys
[email protected]
wrote:

So if i use an unpack_k_bits block, and i set k to 1, will I be handle 1
bit at a time?

Yes.

Dear Marbelly,

unpack_k_bits with k = 1 means, for instance,
a byte sample 0x0F (0b0000 1111) in a stream
is unpacked to 0x00 0x00 0x00 0x00 0x01 0x01 0x01 0x01 (MSB first)
and only the first insignificant sample is taken and the rest 7 samples
are

So if you want to process 8 bits in a byte individually, use
unpack_k_bits
with k = 8.

Regards,
Jeon.

2015-06-17 11:49 GMT+09:00 Marbellys [email protected]:

Hi Jeon.

Thank you very much for your response.

So if I have for example a vector source V =
(1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1 (which output’s type is set to byte),
the
first stream at the output will be (1,1,0,1,0,0,1,0), is this right?
Then, if I use an unpack_k_bits with k = 8 at its output, will I be able
to
save each of this bits in a vector in a new block and to manipulated
them
individually?

Thank you.
Marbellys.

View this message in context: