| 364 | |
| 365 | |
| 366 | static U32 validateTreeRecurse(TreeNode *tree) |
| 367 | { |
| 368 | if(tree == NIL) |
| 369 | return 1; |
| 370 | // check my left tree |
| 371 | S32 lcount, rcount, nc = 0; |
| 372 | |
| 373 | if(tree->color == Red) |
| 374 | { |
| 375 | if(tree->left->color == Red || tree->right->color == Red) |
| 376 | Platform::debugBreak(); |
| 377 | } |
| 378 | else |
| 379 | nc = 1; |
| 380 | |
| 381 | FreeHeader *walk = tree->queueHead; |
| 382 | if(!walk) |
| 383 | Platform::debugBreak(); |
| 384 | |
| 385 | FreeHeader *prev = NULL; |
| 386 | while(walk) |
| 387 | { |
| 388 | if(walk->prevQueue != prev) |
| 389 | Platform::debugBreak(); |
| 390 | if(walk->treeNode != tree) |
| 391 | Platform::debugBreak(); |
| 392 | if(walk->size != tree->size) |
| 393 | Platform::debugBreak(); |
| 394 | if(!walk->nextQueue && walk != tree->queueTail) |
| 395 | Platform::debugBreak(); |
| 396 | prev = walk; |
| 397 | walk = walk->nextQueue; |
| 398 | } |
| 399 | |
| 400 | lcount = validateTreeRecurse(tree->left); |
| 401 | rcount = validateTreeRecurse(tree->right); |
| 402 | if(lcount != rcount) |
| 403 | Platform::debugBreak(); |
| 404 | return lcount + nc; |
| 405 | } |
| 406 | |
| 407 | static void validateParentageRecurse(TreeNode *tree) |
| 408 | { |