Optimizations in toData of long