I have a Mx4 matrix, which hold a RGBA color palette (stored in int32) and 
need to pack into a vector of 4-bytes values. So I think Stefan's 
suggestion is what I need (sorry to have given the example with UInt8 but 
it was to make is supposedly clearer)

sábado, 28 de Março de 2015 às 01:20:05 UTC, Jameson escreveu:
>
> That depends on where the data is coming from and how it is to be encoded. 
> For the example you have, I would suggest the following expression:
>
> 0x010205ff
>
> Which encodes the specified data a UInt32, independent of platform 
> endianness.
>
> On Fri, Mar 27, 2015 at 9:04 PM J Luis  wrote:
>
> Hi, 
>>
>> How can I encode  4 one byte variable, lets say 
>>
>> julia> UInt8[1 2 5 255]
>> 1x4 Array{UInt8,2}:
>>  0x01  0x02  0x05  0xff
>>
>> into a single variable with 4 bytes length?
>>
>> Thanks.
>>
> ​
>

Reply via email to