Logic Help - Navigation with gyro + encoders

Something like this will solve for turning whichever way is shortest.

if destination_heading is less than current_heading
    destination_heading += 360;

If destination_heading - current_heading < 180
    turn clockwise.
else
    turn counterclockwise.