]> mj.ucw.cz Git - libucw.git/commitdiff
Partial inlining of bskip().
authorMartin Mares <mj@ucw.cz>
Sat, 20 Nov 2004 15:14:39 +0000 (15:14 +0000)
committerMartin Mares <mj@ucw.cz>
Sat, 20 Nov 2004 15:14:39 +0000 (15:14 +0000)
lib/fastbuf.c
lib/fastbuf.h

index a29dc30b370e8a5c2606eab15edb665b9746bbbb..529bcfc3ce68558d52b31731a160a3796de6f341 100644 (file)
@@ -344,7 +344,7 @@ brewind(struct fastbuf *f)
 }
 
 int
-bskip(struct fastbuf *f, uns len)
+bskip_slow(struct fastbuf *f, uns len)
 {
   while (len)
     {
index 777630c8b92d146c265cb4455d50a0bbe77fc312..12047038486e8f580372b6c8736503598ea712c4 100644 (file)
@@ -122,7 +122,6 @@ void bflush(struct fastbuf *f);
 void bseek(struct fastbuf *f, sh_off_t pos, int whence);
 void bsetpos(struct fastbuf *f, sh_off_t pos);
 void brewind(struct fastbuf *f);
-int bskip(struct fastbuf *f, uns len);
 sh_off_t bfilesize(struct fastbuf *f);
 
 static inline sh_off_t btell(struct fastbuf *f)
@@ -346,6 +345,18 @@ bbcopy(struct fastbuf *f, struct fastbuf *t, uns l)
     bbcopy_slow(f, t, l);
 }
 
+int bskip_slow(struct fastbuf *f, uns len);
+static inline int bskip(struct fastbuf *f, uns len)
+{
+  if (bavailr(f) >= len)
+    {
+      f->bptr += len;
+      return 1;
+    }
+  else
+    return bskip_slow(f, len);
+}
+
 /* I/O on addr_int_t */
 
 #ifdef CPU_64BIT_POINTERS