r10152: 64-bit fix for bug #3082. Thanks to Robin Hill for tracking this down with