summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mixlib/mix_types.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/mixlib/mix_types.h b/mixlib/mix_types.h
index e10f8c7..54509f3 100644
--- a/mixlib/mix_types.h
+++ b/mixlib/mix_types.h
@@ -65,8 +65,9 @@ typedef guint8 mix_char_t;
#define MIX_CHAR_MAX 55
/* Conversions for mix_char_t's */
-#define mix_char_to_byte(mchar) mix_byte_new(mchar)
-#define mix_byte_to_char(byte) ((mix_char_t)((byte) & MIX_CHAR_MAX))
+#define mix_char_new(l) (((l) < MIX_CHAR_MAX )? (l) : MIX_CHAR_MAX)
+#define mix_char_to_byte(mchar) mix_byte_new (mchar)
+#define mix_byte_to_char(byte) mix_char_new (byte)
extern mix_char_t
mix_ascii_to_char(guchar c);