From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3df2441e04d6927e27b52beac75e8c97@9netics.com> To: quanstro@quanstro.net, 9fans@9fans.net Date: Fri, 12 Feb 2016 09:44:59 -0800 From: Skip Tavakkolian <9nut@9netics.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] BCD encoding in Plan9 - don't shoot me Topicbox-Message-UUID: 840824ea-ead9-11e9-9d60-3106f5b1d025 if i understand it correctly (reading wikipedia's description) the field is either packed BCD (each nibble is the binary representation of the digit) or ebcdic representation of the digits (see /sys/src/cmd/dd.c:618) > So, I'm working with ISO8583, a "standard" (HAHAHAH!!!!!) The "standard" > allows but does not require, BCD encoding of numerical data. Which may or > may not have a BCD-encoded numerical length prefix. The prefix may or may > not be 1 to 3 bytes in length. Or the data might come with no prefix, and > be right justified in a fixed width field of known size. Or left justified. > So hard to tell these days. > > But I ramble. So I was just wanting to ask if anyone here has any simple > BCD conversion routines. > > But, actually, ignore the subject line. Just shoot me. /sys/src/9/pc/devrtc.c has an example of simple conversions, but given that standard, i suppose simple is not what you're after. - erik