ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/dynbuf.C
(Generate patch)

Comparing deliantra/server/server/dynbuf.C (file contents):
Revision 1.11 by root, Sat May 26 15:44:08 2007 UTC vs.
Revision 1.12 by root, Sun May 27 22:57:43 2007 UTC

163i2a_9 (char *ptr, uint32 v, bool lz) 163i2a_9 (char *ptr, uint32 v, bool lz)
164{ 164{
165 // convert to 4.56 fixed-point representation 165 // convert to 4.56 fixed-point representation
166 // this should be optimal on 64 bit cpus, and rather 166 // this should be optimal on 64 bit cpus, and rather
167 // slow on 32 bit cpus. go figure :) 167 // slow on 32 bit cpus. go figure :)
168 const int bits = 7*8; // 8 bits per post-comma digit 168 const int bits = 7*8; // 7 bits per post-comma digit
169 169
170 uint64 u = v * ((m (bits) + 100000000) / 100000000); // 10**8 170 uint64 u = v * ((m (bits) + 100000000) / 100000000); // 10**8
171 171
172 if (lz) 172 if (lz)
173 { 173 {
231 force (20); // 19 digits + '-' 231 force (20); // 19 digits + '-'
232 232
233 *ptr = '-'; ptr += i < 0 ? 1 : 0; 233 *ptr = '-'; ptr += i < 0 ? 1 : 0;
234 uint64 u = i < 0 ? -i : i; 234 uint64 u = i < 0 ? -i : i;
235 235
236 if (i < 0)
237 {
238 fadd ('-');
239 u = -i;
240 }
241 else
242 u = i;
243
244 // split the number into a 1-digit part 236 // split the number into a 1-digit part
245 // (#19) and two 9 digit parts (9..18 and 0..8) 237 // (#19) and two 9 digit parts (9..18 and 0..8)
246 238
247 // good compilers will only use multiplications here 239 // good compilers will only use multiplications here
248 240

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines