skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

genqdyn_pop.c (314B)


      1 /* ISC license. */
      2 
      3 #include <errno.h>
      4 #include <skalibs/genqdyn.h>
      5 #include "genqdyn-internal.h"
      6 
      7 int genqdyn_pop (genqdyn *g)
      8 {
      9   if (g->head >= g->queue.len) return (errno = EINVAL, 0) ;
     10   g->head += g->esize ;
     11   if (g->den * (g->queue.len - g->head) <= g->num * g->queue.len) genqdyn_clean(g) ;
     12   return 1 ;
     13 }