1 /* Reimplementation of Daniel J. Bernsteins taia library. 2 * (C) 2001 Uwe Ohse, <uwe@ohse.de>. 3 * Report any bugs to <uwe@ohse.de>. 4 * Placed in the public domain. 5 */ 6 /* @(#) $Id: taia_add.c 1.4 02/10/17 14:40:18+00:00 uwe@ranan.ohse.de $ */ 7 #include "taia.h" 8 9 #define G 1000000000UL 10 11 void taia_add(struct taia * to,const struct taia * src1,const struct taia * src2)12taia_add (struct taia *to, const struct taia *src1, const struct taia *src2) 13 { 14 tai_add(&to->sec,&src1->sec,&src2->sec); 15 to->nano = src1->nano + src2->nano; 16 to->atto = src1->atto + src2->atto; 17 if (to->atto >= G) { 18 to->atto -= G; 19 to->nano++; 20 } 21 if (to->nano >= G) { 22 to->nano -= G; 23 to->sec.x++; 24 } 25 } 26