Generic binary-to-value convertion