Method: CTypes::Struct::Builder#pad
- Defined in:
- lib/ctypes/struct/builder.rb
#pad(bytes) ⇒ Object
allocate unused bytes in the CTypes::Struct This method is used to enforce alignment of other fields, or accurately mimic padding added in C structs by the compiler.
221 222 223 224 225 226 227 228 229 230 |
# File 'lib/ctypes/struct/builder.rb', line 221 def pad(bytes) pad = Pad.new(bytes) # we use the Pad instance as the name of the field so Struct knows to # treat the field as padding @fields << [pad, pad] @bytes += bytes if @bytes self end |