Module: DL::PackInfo

Module | DL::PackInfo
In: | dl/lib/dl/pack.rb

### Methods

align

### Constants

ALIGN_MAP | = | { TYPE_VOIDP => ALIGN_VOIDP, TYPE_CHAR => ALIGN_CHAR, TYPE_SHORT => ALIGN_SHORT, TYPE_INT => ALIGN_INT, TYPE_LONG => ALIGN_LONG, TYPE_LONG_LONG => ALIGN_LONG_LONG, TYPE_FLOAT => ALIGN_FLOAT, TYPE_DOUBLE => ALIGN_DOUBLE, -TYPE_CHAR => ALIGN_CHAR, -TYPE_SHORT => ALIGN_SHORT, -TYPE_INT => ALIGN_INT, -TYPE_LONG => ALIGN_LONG, -TYPE_LONG_LONG => ALIGN_LONG_LONG, }
PACK_MAP | = | { TYPE_VOIDP => ((SIZEOF_VOIDP == SIZEOF_LONG_LONG) ? "q" : "l!"), TYPE_CHAR => "c", TYPE_SHORT => "s!", TYPE_INT => "i!", TYPE_LONG => "l!", TYPE_LONG_LONG => "q", TYPE_FLOAT => "f", TYPE_DOUBLE => "d", -TYPE_CHAR => "c", -TYPE_SHORT => "s!", -TYPE_INT => "i!", -TYPE_LONG => "l!", -TYPE_LONG_LONG => "q", }
SIZE_MAP | = | { TYPE_VOIDP => SIZEOF_VOIDP, TYPE_CHAR => SIZEOF_CHAR, TYPE_SHORT => SIZEOF_SHORT, TYPE_INT => SIZEOF_INT, TYPE_LONG => SIZEOF_LONG, TYPE_LONG_LONG => SIZEOF_LONG_LONG, TYPE_FLOAT => SIZEOF_FLOAT, TYPE_DOUBLE => SIZEOF_DOUBLE, -TYPE_CHAR => SIZEOF_CHAR, -TYPE_SHORT => SIZEOF_SHORT, -TYPE_INT => SIZEOF_INT, -TYPE_LONG => SIZEOF_LONG, -TYPE_LONG_LONG => SIZEOF_LONG_LONG, }
ALIGN_MAP | = | { TYPE_VOIDP => ALIGN_VOIDP, TYPE_CHAR => ALIGN_CHAR, TYPE_SHORT => ALIGN_SHORT, TYPE_INT => ALIGN_INT, TYPE_LONG => ALIGN_LONG, TYPE_FLOAT => ALIGN_FLOAT, TYPE_DOUBLE => ALIGN_DOUBLE, -TYPE_CHAR => ALIGN_CHAR, -TYPE_SHORT => ALIGN_SHORT, -TYPE_INT => ALIGN_INT, -TYPE_LONG => ALIGN_LONG, }
PACK_MAP | = | { TYPE_VOIDP => ((SIZEOF_VOIDP == SIZEOF_LONG_LONG) ? "q" : "l!"), TYPE_CHAR => "c", TYPE_SHORT => "s!", TYPE_INT => "i!", TYPE_LONG => "l!", TYPE_FLOAT => "f", TYPE_DOUBLE => "d", -TYPE_CHAR => "c", -TYPE_SHORT => "s!", -TYPE_INT => "i!", -TYPE_LONG => "l!", }
SIZE_MAP | = | { TYPE_VOIDP => SIZEOF_VOIDP, TYPE_CHAR => SIZEOF_CHAR, TYPE_SHORT => SIZEOF_SHORT, TYPE_INT => SIZEOF_INT, TYPE_LONG => SIZEOF_LONG, TYPE_FLOAT => SIZEOF_FLOAT, TYPE_DOUBLE => SIZEOF_DOUBLE, -TYPE_CHAR => SIZEOF_CHAR, -TYPE_SHORT => SIZEOF_SHORT, -TYPE_INT => SIZEOF_INT, -TYPE_LONG => SIZEOF_LONG, }

### Public Instance methods

align(addr, align)

[Source]

    # File dl/lib/dl/pack.rb, line 97
        def align(addr, align)
          d = addr % align
          if( d == 0 )
            addr
          else
            addr + (align - d)
          end
        end

[Validate]