SETBIT

Since 1.1.0Bitmaps

Syntax

SETBIT key offset value
  • Flags: write
  • ACL categories: @bitmap, @slow, @write
  • Arity: 4

Sets or clears the bit at offset in the string at key. Offset 0 is the most significant bit of the first byte. The string grows, with zero bytes, if it is shorter; a missing key is created.

Reply

  • The bit's value before: 0 or 1.

Examples

> SETBIT b 7 1
(integer) 0
> SETBIT b 7 0
(integer) 1