This is some preliminary helpers and utilities that I've been working on to support my formatting library. These are all useful independently of the formatting library, and I'm not committing anything related to the library itself until this is more complete. But I think it's a good idea to have this review separately so it can be more focused on the details of formatting logic (negative signs, decimals, etc) rather than library machinery.
Note that the top-level functions being modified here (i.e. write_long, write_ulong, etc) are the same functions used by llvm::raw_ostream::operator<<, so this code is being exercised today (albeit with only one set of trivial parameters)
Shouldn't this be named formatToBuffer? Or, perhaps more specifically, formatIntegralTypeToBuffer. Since it's a template function that apparently accepts any type for Value, someone might otherwise mistake it for a more general formatter.