module BinData::Int

def pack_directive(nbits, endian, signed)

def pack_directive(nbits, endian, signed)
  nwords = nbits / bits_per_word(nbits)
  directives = { 8 => 'C', 16 => 'S', 32 => 'L', 64 => 'Q' }
  d = directives[bits_per_word(nbits)]
  d += ((endian == :big) ? '>' : '<') unless d == 'C'
  if signed == :signed && directives.key?(nbits)
    (d * nwords).downcase
  else
    d * nwords
  end
end