diff options
Diffstat (limited to 'mixlib/mix_types.c')
-rw-r--r-- | mixlib/mix_types.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mixlib/mix_types.c b/mixlib/mix_types.c index 4baa4f0..79e0bb6 100644 --- a/mixlib/mix_types.c +++ b/mixlib/mix_types.c @@ -476,6 +476,18 @@ mix_word_print_to_file (mix_word_t word, const char *message, FILE *f) fprintf (f, "(%010ld)", mix_word_magnitude (word)); } +void +mix_word_print_to_buffer (mix_word_t word, gchar *buf) +{ + guint k; + g_return_if_fail (buf != NULL); + sprintf (buf, "%s ", mix_word_sign (word) == 0 ? "+" : "-"); + for ( k = 1; k < 6; ++k ) { + sprintf (buf + 2 + 3 * (k -1), "%02d ", mix_word_get_byte (word,k)); + } + /* sprintf (buf, "(%010ld)", mix_word_magnitude (word));*/ +} + /* Conversions between words and shorts */ mix_short_t mix_word_to_short (mix_word_t word) @@ -538,6 +550,16 @@ mix_short_print (mix_short_t s, const gchar *message) g_print ("(%04d)", mix_short_magnitude (s)); } +void +mix_short_print_to_buffer (mix_short_t s, gchar *buf) +{ + g_return_if_fail (buf != NULL); + sprintf (buf, "%s %02d %02d", + mix_short_sign (s) == 0 ? "+" : "-", + mix_byte_new (s>>6), mix_byte_new (s)); + /* g_print ("(%04d)", mix_short_magnitude (s));*/ +} + |