suitcase

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

taia_add.c (381B)


      1 #include <tai/taia.h>
      2 
      3 /* XXX: breaks tai encapsulation */
      4 
      5 void taia_add(struct taia *t, struct taia *u, struct taia *v)
      6 {
      7   t->sec.x = u->sec.x + v->sec.x;
      8   t->nano = u->nano + v->nano;
      9   t->atto = u->atto + v->atto;
     10   if (t->atto > 999999999UL) {
     11     t->atto -= 1000000000UL;
     12     ++t->nano;
     13   }
     14   if (t->nano > 999999999UL) {
     15     t->nano -= 1000000000UL;
     16     ++t->sec.x;
     17   }
     18 }