- t_tmpl[0] = 0x98000000;
- left = s_tmpl[0] >> 16;
- if (left & 0x8000)
- left |= 0xf0000;
- right = s_tmpl[0] & 0xffff;
- if (right & 0x8000)
- right |= 0xf0000;
- if (swap) {
- t_tmpl[1] = left & 0xff;
- t_tmpl[2] = ((left & 0xff00) << 16) | ((right & 0xff) << 12) |
- ((right & 0xff00) >> 4);
- } else {
- t_tmpl[1] = left >> 8;
- t_tmpl[2] = ((left & 0xff) << 24) | (right << 4);
- }
+ u32 tmp;
+
+ t_tmpl[0] = cpu_to_be32(0x98000000);
+
+ tmp = be32_to_cpu(s_tmpl[0]);
+ left = tmp & 0xffff;
+ right = tmp >> 16;
+ if (swap) {
+ left = swab16(left);
+ right = swab16(right);
+ }
+ t_tmpl[1] = cpu_to_be32(left >> 8);
+ t_tmpl[2] = cpu_to_be32(((left & 0xff) << 24) |
+ (right << 4));
+