5

I'm developing an application for a 16-bit embedded device (80251 microcontroller), and I need arbitrary precision arithmetic. Does anyone know of a library that works for the 8051 or 80251?

GMP doesn't explicitly support the 8051, and I'm wary of the problems I could run into on a 16-bit device.

Thanks

Eric
  • 51
  • 1
  • Have you considered writing these operations yourself. The fact that your are wary of problems on a 16-bit device makes me think that Add and Multiply would be fairly easy for you. Mod is a little bit more work but still doable. – semaj Jul 01 '11 at 15:26

1 Answers1

3

Try this one. Or, give us an idea of what you're trying to do with it; understanding the workload would help a lot. TTMath looks promising. Or, there are approximately a zillion of them listed in the Wikipedia article.

Charlie Martin
  • 103,438
  • 22
  • 180
  • 253
  • I'm trying to implement some basic crypto on a 16-bit processor. Obviously speed is not important, but I need to be able to work with numbers in the range of say, 128 to 2048 bits. So I actually *don't* need arbitrary precision, but something that can handle 2048 bits at least. I'd also settle for an 8-bit library. I had checked out several from the Wiki, but none of them appeared to be compatible with a 251. Thanks for your response, I'll check out your suggestions. – Eric Jul 01 '11 at 13:29
  • I suppose I should mention which operations are critical: add, mul, and mod are mandatory. div and floating point support are not necessary. – Eric Jul 01 '11 at 13:31
  • Go for a pure-C library then. Minor twiddling of the size declarations should work out. Honestly, a bignum implementation shouldn't be very sensitive to word size as long as you aren't trying to optimize heavily. – Charlie Martin Jul 02 '11 at 02:00