runit

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

taia_add.c (409B)


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