str)
let endian_of_architecture = function
- | I386 | X86_64 -> Bitmatch.LittleEndian
- | IA64 -> Bitmatch.LittleEndian (* XXX usually? *)
- | PPC | PPC64 | SPARC | SPARC64 -> Bitmatch.BigEndian
+ | I386 | X86_64 -> Bitstring.LittleEndian
+ | IA64 -> Bitstring.LittleEndian (* XXX usually? *)
+ | PPC | PPC64 | SPARC | SPARC64 -> Bitstring.BigEndian
type wordsize =
| W32 | W64
in
let xs = loop xs in
List.rev (List.sort compare xs)
+
+(* Pad a string to a fixed width (from virt-top, but don't truncate). *)
+let pad width str =
+ let n = String.length str in
+ if n >= width then str
+ else (* if n < width then *) str ^ String.make (width-n) ' '