OPTIM: buffer: remove one jump in buffer_count()

We can help gcc build an expression not involving a jump. This function
is used a lot when parsing chunks.
This commit is contained in:
Willy Tarreau 2013-04-02 01:25:57 +02:00
parent 7035132349
commit bf43927cd7
1 changed files with 2 additions and 2 deletions

View File

@ -272,8 +272,8 @@ static inline const char *buffer_pointer(const struct buffer *buf, const char *p
static inline int buffer_count(const struct buffer *buf, const char *from, const char *to)
{
int count = to - from;
if (count < 0)
count += buf->size;
count += count < 0 ? buf->size : 0;
return count;
}