Fix invalid-shift-base reported by ubsan.
Fix invalid-shift-base reported by ubsan.

(value_ can be -1)

PiperOrigin-RevId: 432081057

tensorflow/runtime,tensorflow/runtime,tensorflow/runtime,tensorflow/runtime