Replacing intval() with casting

as per http://hakre.wordpress.com/2010/05/13/php-casting-vs-intval/
casting is much much faster.

Change-Id: I6b3ef8d6715fd78ac9119cb8448489ba535ea5da
Merge "Replacing intval() with casting"