rbranson/node-ffi — Issue #33: Helper for Bit fields
Author: TooTallNate
Created: 2012-01-03 05:21:41+00:00
State: open

A `Pointer` subclass that provides a nice API for bit fields.
http://en.wikipedia.org/wiki/Bit_field

``` js
var Preference = new ffi.BitField('likesIceCream', 'playsGolf', 'watchesTV', 'readsBooks')

var p = new Preference()

p.likesIceCream
// false
p.likesIceCream = true
// true

p.playsGolf = true
// true

// etc…
```

Use an `int`-size backing, allowing for up to 31 fields.
Fields only allow `true`/`false` values and all default to `false` (maybe make that configurable?).