Module: FFI::BitField

Defined in:
lib/ffi/bit_field.rb,
lib/ffi/bit_field/layout.rb,
lib/ffi/bit_field/version.rb,
lib/ffi/bit_field/property.rb

Overview

BitField provides bit field functionality for Ruby-FFI. It allows defining, reading, and writing bit fields within FFI structs.

Examples:

Basic usage

class MyStruct < FFI::BitStruct
  layout \
    :flags, :uint8

  bit_fields :flags,
    :flag1, 1,
    :flag2, 1,
    :value, 6
end

struct = MyStruct.new
struct[:flag1] = 1
struct[:value] = 42

Defined Under Namespace

Modules: Layout, Property

Constant Summary collapse

VERSION =

Current version of the ffi-bitfield gem.

'0.0.8'