1 #include <kiba/format/options.h>
6 .alignment = FORMAT_ALIGN_RIGHT,
11 void format_calculate_padding(
format_options options, usize data_length, usize *left_pad, usize *right_pad) {
14 if (options.width > data_length) {
15 usize diff = options.width - data_length;
16 switch (options.alignment) {
17 case FORMAT_ALIGN_RIGHT:
20 case FORMAT_ALIGN_LEFT:
23 case FORMAT_ALIGN_CENTER:
24 *right_pad = diff / 2;
25 *left_pad = diff - *right_pad;