You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
look at this picture above plz...we know that the type of "rest ", "data.blockSize" and "requiredSize" is std::size_t.
However, std::size_t is unsigned __int64. So they are unsigned. if you do "rest = affectedNode->data.blockSize - requiredSize", it will always get a value greater than zero. when "data.blockSize < requiredSize", it will be a great trouble ("rest" will be a Huge unsigned number).....
a better way is:
The text was updated successfully, but these errors were encountered:
No-47
changed the title
find some small bug here
find a small bug here
Oct 23, 2020
If the Find method returned a result (affectedNode), it means that affectedNode->data.blockSize is always greater or equals to requiredSize. Otherwise, there is not enough memory (and you may want to return nullptr)
However, in this piece of code, the if(rest > 0) may be replaced by if(rest > sizeof(Node)) since we need at least the room for a Node.
look at this picture above plz...we know that the type of "rest ", "data.blockSize" and "requiredSize" is std::size_t.
However, std::size_t is unsigned __int64. So they are unsigned. if you do "rest = affectedNode->data.blockSize - requiredSize", it will always get a value greater than zero. when "data.blockSize < requiredSize", it will be a great trouble ("rest" will be a Huge unsigned number).....
a better way is:
The text was updated successfully, but these errors were encountered: