- Timestamp:
- Jun 6, 2015, 7:55:16 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20150429/src/libfits/table/F_get_column.c
r38366 r38404 76 76 } 77 77 78 /* convert data in-situ with correct type, byte swap and Bzero/Bscale */ 78 // NOTE: we have already copied the data to 'array', so the blocks below 79 // only need to swap if this is a direct copy 79 80 Pin = array; 80 81 Pout = array; 82 int directCopy = (Bzero == 0.0) && (Bscale == 1.0); 83 84 /* convert data in-situ with correct type, byte swap and Bzero/Bscale */ 81 85 if (!strcmp (type, "char")) { 82 86 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 83 *(char *)Pout = *(char *)Pin*Bscale + Bzero;87 if (!directCopy) { *(char *)Pout = *(char *)Pin*Bscale + Bzero; } 84 88 } 85 89 } 86 90 if (!strcmp (type, "byte")) { 87 91 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 88 *(char *)Pout = *(char *)Pin*Bscale + Bzero;92 if (!directCopy) { *(char *)Pout = *(char *)Pin*Bscale + Bzero; } 89 93 } 90 94 } … … 94 98 if (!nativeOrder) { SWAP_BYTE; } 95 99 # endif 96 *(short *)Pout = *(short *)Pin*Bscale + Bzero;100 if (!directCopy) { *(short *)Pout = *(short *)Pin*Bscale + Bzero; } 97 101 } 98 102 } … … 102 106 if (!nativeOrder) { SWAP_WORD; } 103 107 # endif 104 *(int *)Pout = *(int *)Pin*Bscale + Bzero;108 if (!directCopy) { *(int *)Pout = *(int *)Pin*Bscale + Bzero; } 105 109 } 106 110 } 107 111 if (!strcmp (type, "int64_t")) { 108 if ((Bzero == 0.0) && (Bscale == 1.0)) { 109 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 110 # ifdef BYTE_SWAP 111 if (!nativeOrder) { SWAP_DBLE; } 112 # endif 113 *(int64_t *)Pout = *(int64_t *)Pin; 114 } 115 } else { 116 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 117 # ifdef BYTE_SWAP 118 if (!nativeOrder) { SWAP_DBLE; } 119 # endif 120 *(int64_t *)Pout = *(int64_t *)Pin*Bscale + Bzero; 121 } 112 for (i = 0; i < Nval*Ny; i++, Pin+=Nbytes, Pout+=Nbytes) { 113 # ifdef BYTE_SWAP 114 if (!nativeOrder) { SWAP_DBLE; } 115 # endif 116 if (!directCopy) { *(int64_t *)Pout = *(int64_t *)Pin*Bscale + Bzero; } 122 117 } 123 118 } … … 127 122 if (!nativeOrder) { SWAP_WORD; } 128 123 # endif 129 *(float *)Pout = *(float *)Pin*Bscale + Bzero;124 if (!directCopy) { *(float *)Pout = *(float *)Pin*Bscale + Bzero; } 130 125 } 131 126 } … … 135 130 if (!nativeOrder) { SWAP_DBLE; } 136 131 # endif 137 *(double *)Pout = *(double *)Pin*Bscale + Bzero;132 if (!directCopy) { *(double *)Pout = *(double *)Pin*Bscale + Bzero; } 138 133 } 139 134 }
Note:
See TracChangeset
for help on using the changeset viewer.
