include bin2bcd
for something inline....
#include <math.h>
#include <stdio.h>
int y,x,z,bits,bit,array;
bits =24;
array=0; {bitvalue 3rd dimention position {super position}}
LONG bitvalue[array];
bitvalue = convertion input value
BOOL fifo[bits];
x=1;
z=1; {can be used to choose what bit to address like a rom you just update changed bits only}
for(y=0;y<=bits
{
(fifo[bit])? bitvalue[array] |= (x) : bitvalue[array] &= ~(x); //bitvalue can be an array
x=x+x;
bit=bit+z;
y++;
}
i see a mistake here not so easy to fix
ill think more on this
you can enclose the whole object in a void routine if you like
gives more variables also to break the scope of use out a little
void'd routines are cool but inline is better
something along this lines is maybe usefull as a converter buffer
even adding a convertion mode is easier
choice is there also to do group block convertions
ie if you need 8 bit result then only do 8 bit convertions with no padding
or you can build a 3d array like ram
using a constructor like
bit = 24;
bits =24;
long[bit][bits];
to give 24 by 24 bit by 24 bit 3d dimention array
give result tables using convertion explode functions
its actualy faster in pentium to calculate more results at once than lots of little groups
then just point to the start of your group and leech it off
you can also use two arrays inside each other
to strobe the result and actual convertion sequence
to your needs
attached is a little console type app
i use this method to perfect little maths functions
the test this does is
write 4 bytes to two dwords then to a long
then the long back to the bytes
then generate a random number
i think this method maybe best for you to use
to makeup and tailor to your exact needs