0.01
No commit activity in last 3 years
No release in over 3 years
FFI plugin which adds support for bitmasked types (or flags) to FFI.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 10.4
~> 3.0
~> 0.8

Runtime

~> 1.0
 Project Readme

ffi-bit_masks

Description

FFI plugin which adds support for bitmasked types (or flags) to FFI.

Features

  • Can map a Hash of flags to their bitmask value.
  • Can map an Integer bitmask to a Hash of flags.

Examples

require 'ffi/bit_masks'

module MyLibrary
  extend FFI::Library

  ffi_lib 'foo'

  bit_mask :flags, {foo: 0x1, bar: 0x2, baz: 0x4}

  attach_function :my_func, [:pointer, :size_t, :flags], :int
end

Requirements

Install

$ gem install ffi-bit_masks

Copyright

Copyright (c) 2012-2013 Hal Brodigan

See {file:LICENSE.txt} for details.