Inline to_byte utility function