core: support signed ints and custom capacity in `Int::to_bytes`