Bitwise operation for MCP4922
Why not:

data[1] = ((dac_data &gt;&gt; 8) &amp; 0x0f) | 0x10;
data[0] = dac_data;


Simplify the math, and remove | bitwise OR operation from the places where it must not be (otherwise you will use the values already existing in those locations.