If it is, you copy it to one, then multiply tmp by 10. You do this by checking if tmp is less than the value. First, you find the largest power of ten not greater than the value. You initialize tmp to 1 (i.e., all zeros except least significant byte 1). */ unsigned char biguint_mul10(unsigned char a, unsigned char n, unsigned char c) The idea is that you create two temporary biguints the same size as the value to be printed, one and tmp. ![]() Returns 0 if successful, overflow byte otherwise. Code: /* a b: -1 */ signed char biguint_cmp(unsigned char a, unsigned char b, unsigned char n) /* a += b, returns 0 if successful, overflow byte otherwise */ unsigned char biguint_add(unsigned char a, unsigned char b, unsigned char n) /* a -= b, returns 0 if successful, nonzero if b > a (and a garbled?) */ unsigned char biguint_sub(unsigned char a, unsigned char b, unsigned char n) /* a = 10*a + c.
0 Comments
Leave a Reply. |