The Daily CLAD

Community Browser
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Swap Bytes

SercoSteveB
Active Participant

If Numeric Value In = B'00001111 00000111 00000011 00000001', what is Numeric Value Out following execution of the VI?

 

Swap Bytes.png

 

a) B'00001111 00000111 00000011 00000001'

b) B'00001111 00000111 00000001 00000011'

c) B'00000111 00001111 00000011 00000001'

d) B'00000111 00001111 00000001 00000011'

Comments
crossrulz
Knight of NI

D


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
abcd1234z
Member

D

MrStevenUND
Member

D

sankar06
Member

D

Happy to Wire
mohamedtanveej17
Member

Can anyone explain about the answer?

crossrulz
Knight of NI

The Swap Bytes works at the word level (16 bits).  For for each 16 bits, the bytes are swapped.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Matt-A.
Member

D

mohamedtanveej17
Member

It's ok...I have 2 doubts..

One is.,that I tried that snippet question into LabVIEW and enter that given string...but it changes to U32 representation's maximum Value...

And one thing.. basically 8bits only be a byte how 16 bits constitute a byte??

crossrulz
Knight of NI

1. Make sure your display is in binary mode.  Right-click, Visible->Radix.  You should see a little 'b' on the left of the control.  If not, click the symbol and change it.

 

2.  16 bits is a WORD.  The Swap Bytes swaps the two bytes in a word.  In the case of the U32, it swaps the bytes in each word.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
SercoSteveB
Active Participant

Answer: D.  Nice one all. 

 

Who knew that it would action each word in a data type containing multiple words.

hussey
Member

Answer D

Swaps the higher order 8 bits and the lower order 8 bits for every word in data.


@SercoSteveB wrote:

If Numeric Value In = B'00001111 00000111 00000011 00000001', what is Numeric Value Out following execution of the VI?

 

Swap Bytes.png

 

a) B'00001111 00000111 00000011 00000001'

b) B'00001111 00000111 00000001 00000011'

c) B'00000111 00001111 00000011 00000001'

d) B'00000111 00001111 00000001 00000011'


 

Tsjabrantes
Member

Hello everyone!

I'm glad to be here. So, according to Swap function the correct answer is letter D.

NI_Swap_Function.png

 

Tarciso Junior
+55 (11) 996-282-103
Skype: Tarciso.junior2
Email: Tsjabrantes@gmail.com
http://br.linkedin.com/pub/tarciso-junior/23/a83/463