I’m not sure if this code is already in cocos2d-x and I just missed it but I figured this out by looking the the CGRectIntersection code for iOS.
This is the code for CGRectIntersection to get the intersecting rect of the of two rects:
intersection = CCRectMake(std::max(CCRect::CCRectGetMinX(r1),CCRect::CCRectGetMinX(r2)), std::max(CCRect::CCRectGetMinY(r1),CCRect::CCRectGetMinY(r2)),0,0);
intersection.size.width = std::min(CCRect::CCRectGetMaxX(r1), CCRect::CCRectGetMaxX(r2)) - CCRect::CCRectGetMinX(intersection);
intersection.size.height = std::min(CCRect::CCRectGetMaxY(r1), CCRect::CCRectGetMaxY(r2)) - CCRect::CCRectGetMinY(intersection);