rdcost: explicit cast of return value, to prevent MSVC warnings
Merge with stable