XC8's Microchip compiler long type doesn't go up 32bits value
The problem is not with your type but with the way you print it. In C 
%d format specifier is for int, not for long. For signed long you should use %ld instead, if your compiler supports it. For unsigned use %lu.