BBitWhorl
Product

Product features · Fixed-width bit rotation

01

Check zero and full-width rotations with counts reduced modulo the width, rejecting negative counts and values that do not fit.

01

Connection

Base URL, credentials and a reachable server.

02

Selection

A model available through the configured endpoint.

03

Capabilities

Context limits and tool support are determined by the model and server.

Fixed-width bit rotation

● ● ●BitWhorl●
A concrete starting point · Fixed-width bit rotation ×
def rotate_left(value, count, width):
    if any(type(x) is not int for x in (value, count, width)):
        raise ValueError("rotate.type")
    if not 1 <= width <= 64 or not 0 <= value < (1 << width) or count < 0:
        raise ValueError("rotate.range")
    count %= width
    mask = (1 << width) - 1
    return ((value << count) | (value >> (width - count))) & mask
✳Fixed-width bit rotation
✓ ChangesReview before applying ↗
Illustrative workspace
AI coding workspace

Your next change starts here.

Get the Windows app ↗