]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/ff-varint.h
Merge branch 'master' into table
[libucw.git] / ucw / ff-varint.h
index 3228fbfa017c3c90a37a329713d84482d5871fd4..fad39854bbd1f09913a49d405709137b15bd667f 100644 (file)
 #include <ucw/fastbuf.h>
 #include <ucw/varint.h>
 
 #include <ucw/fastbuf.h>
 #include <ucw/varint.h>
 
+#ifdef CONFIG_UCW_CLEAN_ABI
+#define bget_varint_slow ucw_bget_varint_slow
+#define bput_varint_slow ucw_bput_varint_slow
+#endif
+
 u64 bget_varint_slow(struct fastbuf *b, u64 repl);
 void bput_varint_slow(struct fastbuf *b, u64 u);
 
 u64 bget_varint_slow(struct fastbuf *b, u64 repl);
 void bput_varint_slow(struct fastbuf *b, u64 u);
 
@@ -22,12 +27,12 @@ void bput_varint_slow(struct fastbuf *b, u64 u);
  **/
 static inline u64 bget_varint_repl(struct fastbuf *b, u64 repl)
 {
  **/
 static inline u64 bget_varint_repl(struct fastbuf *b, u64 repl)
 {
-       uns l;
+       uint l;
        if (bavailr(b) >= 1) {
                l = varint_len(*b->bptr);
                if (bavailr(b) >= l) {
        if (bavailr(b) >= 1) {
                l = varint_len(*b->bptr);
                if (bavailr(b) >= l) {
-                       b->bptr += l;
                        varint_get(b->bptr, &repl);
                        varint_get(b->bptr, &repl);
+                       b->bptr += l;
                        return repl;
                }
        }
                        return repl;
                }
        }
@@ -38,7 +43,7 @@ static inline u64 bget_varint_repl(struct fastbuf *b, u64 repl)
  * Reads u64 encoded as varint from the fastbuf b.
  * If the read is unsuccessful, returns ~0LLU.
  **/
  * Reads u64 encoded as varint from the fastbuf b.
  * If the read is unsuccessful, returns ~0LLU.
  **/
-static inline int bget_varint(struct fastbuf *b)
+static inline u64 bget_varint(struct fastbuf *b)
 {
        return bget_varint_repl(b, ~0LLU);
 }
 {
        return bget_varint_repl(b, ~0LLU);
 }
@@ -46,7 +51,7 @@ static inline int bget_varint(struct fastbuf *b)
 /** Writes u64 u encoded as varint to the fastbuf b. **/
 static inline void bput_varint(struct fastbuf *b, u64 u)
 {
 /** Writes u64 u encoded as varint to the fastbuf b. **/
 static inline void bput_varint(struct fastbuf *b, u64 u)
 {
-       uns l = varint_space(u);
+       uint l = varint_space(u);
        if (bavailw(b) >= l)
                b->bptr += varint_put(b->bptr, u);
        else
        if (bavailw(b) >= l)
                b->bptr += varint_put(b->bptr, u);
        else