Changeset 37039 for trunk/Ohana/src/libfits/table/F_set_column.c
- Timestamp:
- Jul 17, 2014, 10:14:43 AM (12 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libfits/table/F_set_column.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libfits/table/F_set_column.c
r35101 r37039 81 81 Pin = data; 82 82 Pout = array; 83 // does it makes sense to scale 'char' data? 83 84 if (!strcmp (type, "char")) { 85 for (i = 0; i < Nval*Nrow; i++, Pin+=Nbytes, Pout+=Nbytes) { 86 *(char *)Pout = (*(char *)Pin - Bzero) / Bscale; 87 } 88 } 89 if (!strcmp (type, "byte")) { 84 90 for (i = 0; i < Nval*Nrow; i++, Pin+=Nbytes, Pout+=Nbytes) { 85 91 *(char *)Pout = (*(char *)Pin - Bzero) / Bscale; … … 221 227 Pout = array; 222 228 229 // # define ASSIGN_DATA(ITYPE,INAME,ISIZE,OTYPE,ONAME) 230 // if (!strcmp (intype, #ITYPE)) { 231 223 232 /** input == char **/ 224 233 if (!strcmp (outtype, "char") && !strcmp (intype, "char")) { … … 228 237 } 229 238 } 239 if (!strcmp (outtype, "byte") && !strcmp (intype, "char")) { 240 int NbytesIn = 1; 241 for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) { 242 *(char *)Pout = (*(char *)Pin - Bzero) / Bscale; 243 } 244 } 230 245 if (!strcmp (outtype, "short") && !strcmp (intype, "char")) { 231 246 int NbytesIn = 1; … … 265 280 } 266 281 if (!strcmp (outtype, "double") && !strcmp (intype, "char")) { 282 int NbytesIn = 1; 283 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 284 *(double *)Pout = (*(char *)Pin - Bzero) / Bscale; 285 # ifdef BYTE_SWAP 286 SWAP_DBLE; 287 # endif 288 } 289 } 290 291 /** input == byte **/ 292 if (!strcmp (outtype, "char") && !strcmp (intype, "byte")) { 293 int NbytesIn = 1; 294 for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) { 295 *(char *)Pout = (*(char *)Pin - Bzero) / Bscale; 296 } 297 } 298 if (!strcmp (outtype, "byte") && !strcmp (intype, "byte")) { 299 int NbytesIn = 1; 300 for (i = 0; i < Nval*Nrow; i++, Pin+=NbytesIn, Pout+=NbytesOut) { 301 *(char *)Pout = (*(char *)Pin - Bzero) / Bscale; 302 } 303 } 304 if (!strcmp (outtype, "short") && !strcmp (intype, "byte")) { 305 int NbytesIn = 1; 306 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 307 *(short *)Pout = (*(char *)Pin - Bzero) / Bscale; 308 # ifdef BYTE_SWAP 309 SWAP_BYTE; 310 # endif 311 } 312 } 313 if (!strcmp (outtype, "int") && !strcmp (intype, "byte")) { 314 int NbytesIn = 1; 315 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 316 *(int *)Pout = (*(char *)Pin - Bzero) / Bscale; 317 # ifdef BYTE_SWAP 318 SWAP_WORD; 319 # endif 320 } 321 } 322 if (!strcmp (outtype, "int64_t") && !strcmp (intype, "byte")) { 323 int NbytesIn = 1; 324 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 325 *(int64_t *)Pout = (*(char *)Pin - Bzero) / Bscale; 326 # ifdef BYTE_SWAP 327 SWAP_DBLE; 328 # endif 329 } 330 } 331 if (!strcmp (outtype, "float") && !strcmp (intype, "byte")) { 332 int NbytesIn = 1; 333 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 334 *(float *)Pout = (*(char *)Pin - Bzero) / Bscale; 335 # ifdef BYTE_SWAP 336 SWAP_WORD; 337 # endif 338 } 339 } 340 if (!strcmp (outtype, "double") && !strcmp (intype, "byte")) { 267 341 int NbytesIn = 1; 268 342 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { … … 281 355 } 282 356 } 357 if (!strcmp (outtype, "byte") && !strcmp (intype, "short")) { 358 int NbytesIn = 2; 359 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 360 *(char *)Pout = (*(short *)Pin - Bzero) / Bscale; 361 } 362 } 283 363 if (!strcmp (outtype, "short") && !strcmp (intype, "short")) { 284 364 int NbytesIn = 2; … … 334 414 } 335 415 } 416 if (!strcmp (outtype, "byte") && !strcmp (intype, "int")) { 417 int NbytesIn = 4; 418 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 419 *(char *)Pout = (*(int *)Pin - Bzero) / Bscale; 420 } 421 } 336 422 if (!strcmp (outtype, "short") && !strcmp (intype, "int")) { 337 423 int NbytesIn = 4; … … 387 473 } 388 474 } 475 if (!strcmp (outtype, "byte") && !strcmp (intype, "int64_t")) { 476 int NbytesIn = 8; 477 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 478 *(char *)Pout = (*(int64_t *)Pin - Bzero) / Bscale; 479 } 480 } 389 481 if (!strcmp (outtype, "short") && !strcmp (intype, "int64_t")) { 390 482 int NbytesIn = 8; … … 440 532 } 441 533 } 534 if (!strcmp (outtype, "byte") && !strcmp (intype, "float")) { 535 int NbytesIn = 4; 536 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 537 *(char *)Pout = (*(float *)Pin - Bzero) / Bscale; 538 } 539 } 442 540 if (!strcmp (outtype, "short") && !strcmp (intype, "float")) { 443 541 int NbytesIn = 4; … … 488 586 /** input == double **/ 489 587 if (!strcmp (outtype, "char") && !strcmp (intype, "double")) { 588 int NbytesIn = 8; 589 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) { 590 *(char *)Pout = (*(double *)Pin - Bzero) / Bscale; 591 } 592 } 593 if (!strcmp (outtype, "byte") && !strcmp (intype, "double")) { 490 594 int NbytesIn = 8; 491 595 for (i = 0; i < Nval*Nrow; i++, Pin += NbytesIn, Pout += NbytesOut) {
Note:
See TracChangeset
for help on using the changeset viewer.
