Masks, shifts, and bitwise operations

F-BITWISE-V4-3hard

Set the storage tier

Folder commands update selected bits in an eight-bit record; the storage tier and other status must survive changes outside their fields.

What needs to change

Repair setTier so the storage tier in bits 4 and 5 is replaced and every other bit is kept.

Reproduce

  1. Compile and run the one-tier sample with g++, then use Check work for sessions that change an existing tier.

Acceptance criteria

Your review marks · Saved in this browser. Test acceptance is tracked separately.

Notes

The file contains its headers, the Command struct, tierShift, readSession, bits, grant, revoke and main. The browser compiles with g++ -std=c++23.

Bits 0–3 are permissions, bits 4–5 the tier, bit 6 locked and bit 7 archived. A tier line carries 0 to 3.

Sign in to open this exercise

The ticket brief is public. Sign in to access the exercise. Paid exercises require Pro.

Sign in