LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
bruno_costa

Bullet to Convert Any Numeric Type or Numeric Array to U8 Array

Status: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined. 

Will be great if exists a function to convert any numeric type to byte array or any numeric type array to byte array

like Array to String Function and fast like.

 

Now we can use typecast function to do this, but is very slow, compared with string to byte array function.

 

Split or Join numbers function are not pratic if we splitting u64 numbers from to u8 numbers and generate local

copies of numbers.

 

u32--------------DD---------------[u8]

u64--------------DD---------------[u8]

[u32]------------DD---------------[u8]

 

 

[u8]--------------DD---------------[u32]

[u8]--------------DD---------------[u64]

 

 

3 Comments
altenbach
Knight of NI

> Now we can use typecast function to do this, but is very slow, compared with string to byte array function.

 

"Very slow" are very strong words :o. What kind of benchmark test would lead you to this strange conclusions?

AristosQueue (NI)
NI Employee (retired)

Typecast is as fast as you're going to get. The current is implemented with a heap allocation and a move block. There's no getting around either of those operations, and, yeah, you have to have the heap allocation, and you don't have to have one with the string case because the string is already allocated with the same structure as a byte array. Thus the string-to-byte-array operation is a no-op, and all the others have overhead. There's nothing faster you can propose or we can build. If you need better performance, you'll need a different mathematical universe.  So this request should be closed as "Already exists in LabVIEW."

Darren
Proven Zealot
Status changed to: Declined

Any idea that has not received any kudos within a year after posting will be automatically declined.