tools: cast the right operand

Properly apply the fix intended by SVN r201032.