def _shift_in_bounds(x: TfVal, y: TfVal) -> TfVal:
    x_bits = (8 * x.dtype.size)
    y_comp = (tf.cast(y, _UNSIGNED_TO_SIGNED_TABLE[y.dtype]) if y.dtype.is_unsigned else y)
    y_lt_x_bits = tf.math.less(y_comp, x_bits)
    y_ge_0 = tf.math.greater_equal(y_comp, 0)
    return tf.logical_and(y_lt_x_bits, y_ge_0)
def _shift_in_bounds(x: TfVal, y: TfVal) -> TfVal:
    x_bits = (8 * x.dtype.size)
    y_comp = (tf.cast(y, _UNSIGNED_TO_SIGNED_TABLE[y.dtype]) if y.dtype.is_unsigned else y)
    y_lt_x_bits = tf.math.less(y_comp, x_bits)
    y_ge_0 = tf.math.greater_equal(y_comp, 0)
    return tf.logical_and(y_lt_x_bits, y_ge_0)