SwapByte Function | |
Exchange the right and left halves of a byte.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.21
Syntax FUNCTION SwapByte(
bSwap AS BYTE
) AS BYTE
public static byte SwapByte(
byte bSwap
)
Request Example
View SourceParameters
- bSwap
- Type: Byte
The byte whose nibbles you want to swap.
Return Value
Type:
Byte
The byte value with swapped nibbles.
Remarks
SwapByte() swaps the right nibble of a byte with the left nibble of a byte and returns the result. (A nibble is 4 bits, which is half of a byte.)
Examples
This example uses SwapByte() on the character "A".
The ASCII value of "A" is 65. Thus, its binary representation is 0100 0001. Swapping it gives 0001 0100.
Therefore, an ASCII value of 20 is returned.
See Also