Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

Why subtraction is used to compare in nginx_rbtree.c? (1 reply)

$
0
0
When I study the rbtree of nginx I can't understand the comments. Can
someone give me a concrete example?Thanks :)

for ( ;; ) {

/*
* Timer values
* 1) are spread in small range, usually several minutes,
* 2) and overflow each 49 days, if milliseconds are stored in 32
bits.
* The comparison takes into account that overflow.
*/

/* node->key < temp->key */

p = ((ngx_rbtree_key_int_t) (node->key - temp->key) < 0)
? &temp->left : &temp->right;

if (*p == sentinel) {
break;
}

temp = *p;
}
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Viewing all articles
Browse latest Browse all 7229

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>