# BYTE COERSION

The unary operator (.byte) is the byte coersion operator. It instructs the XCASM compiler to use 8 bit quantities during computation of its operand (i.e the tagged part of the expression).

Consider the following example (where D, G and H are defined as word variables)

The expression:

```	D = G + H
```
would generate
```        0006    08 1F           movf    G+1,w
0007    00 9D           movwf   D+1
0008    08 1E           movf    G,w
000A    00 9C           movwf   D
000B    18 03           btfsc   STATUS,C
000C    0A 9D           incf    D+1
000D    08 21           movf    H+1,w
```
Here you can see that the computation is carried out using 16 bit addition.

```	D = (.byte)(G + H)
```
this would generate
```        000F    08 1E           movf    G,w
0011    01 9D           clrf    D+1
0012    00 9C           movwf   D
```
Here you can see that the computation is carried out using 8 bit addition even though the quantities involved were 16 bits. This is because we told the compiler to do so by using the (.byte) operator.

To be exact, what the (.byte) operator did was to tell the compiler that the sub-expression (G + H) should yield an 8 bit value, and the compiler produced only sufficent code to produce an 8 bit result. Any code necessary to extend the 8 bit result to a 16 bit result was discarded.

Note how using the (.byte) operator is far more efficient than masking out the most significant 8 bits. e.g.

```	D = (G + H) & 0xff
```
would generate:
```        0013    08 1F           movf    G+1,w
0014    00 9D           movwf   D+1
0015    08 1E           movf    G,w