URI:
       tmpmod.c - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tmpmod.c (256B)
       ---
            1 #include "os.h"
            2 #include <mp.h>
            3 #include "dat.h"
            4 
            5 /* remainder = b mod m */
            6 /* */
            7 /* knuth, vol 2, pp 398-400 */
            8 
            9 void
           10 mpmod(mpint *b, mpint *m, mpint *remainder)
           11 {
           12         mpdiv(b, m, nil, remainder);
           13         if(remainder->sign < 0)
           14                 mpadd(m, remainder, remainder);
           15 }