electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

128-bit hex to senary (base 6) efficient tranlation in c


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> 128-bit hex to senary (base 6) efficient tranlation in c
Author Message
t_maggot



Joined: 09 Nov 2006
Posts: 45
Helped: 2


Post05 Jun 2008 17:40   

128-bit hex to senary (base 6) efficient tranlation in c


I have to translate one 128-bit-long number (witch is stored in 16 separate bytes in an array) to a senary (base 6) 25-byte-long char (ascii) string. I am looking for code consuming the least memory space posible. In fact I wonder that maybe there is a way to do this translation without using at all long data types, extended divisions etc.

Any help or directions appreciated.

Added after 4 hours 17 minutes:

Ok, I have found a way to get the number with (24*16) integer divisions with 6, using 7 byte-words as temporary data. This can do the job for me, but if anyone has a better way, you're welcome!
Back to top
Google
AdSense
Google Adsense




Post05 Jun 2008 17:40   

Ads




Back to top
wek



Joined: 21 Dec 2004
Posts: 239
Helped: 26


Post09 Jun 2008 7:57   

128-bit hex to senary (base 6) efficient tranlation in c


You can try the trick used for conversion from bin to decimal: for each bit in the decimal number, multiply the senary number by two (e.g. multiply each digit by two, add carry from lower order, if result >= 6, set carry and perform mod 6) and add the bit from decimal number to the least significant digit of the senary word.

This tends to be rather slow but requires a minimum memory and no division just shifts, thus is suitable for arbitrarily long words.

JW
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> 128-bit hex to senary (base 6) efficient tranlation in c
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
128 bit adders (4)
Help required in removing errors in 128 bit buffer (2)
led display 128*128 full color with ledstudio (7)
32 bit hex to ascii (12)
16 bit Hex to decimal (12)
16 bit Hex to Decimal conversin in C (6)
Conversion of .mcs hex file into JTAG bit stream (3)
(8051) how to convert a 16 bit hex number to dec number? (1)
PIC hex to assembly or hex to C converter (7)
Hex to Hex Representation of Decimal in ASM (5)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS