Wireshark-dev: [Wireshark-dev] BCD ?
From: "Lars Worsaae" <[email protected]>
Date: Fri, 6 Apr 2007 18:57:37 +0200
Desr sirs
Are their a smart(er) way to dissect data which are BCD encoded?
I cant find i tvb_get_* reading BCD.
I had roled my own, but am i and my experimental first time dissector
realy the first and only dissection BCD encoded data?

Rgds Lars

BTW My get'er looks like:
static guint32
tvb_get_bcd(tvbuff_t *tvb, int offset, int length)
{
         int i;
         guint32 val=0;
         for(i=0;i<length;i++){
                    guint8 b = tvb_get_guint8(tvb, offset+i);
                    val = 100*val + ((b>>4)*10 + (b&0xf));
         }
         return val;
}