Changeset 2438


Ignore:
Timestamp:
03/14/07 11:14:44 (13 years ago)
Author:
curtis
Message:

Move Bits.swap utility methods into DataTools.

Location:
trunk/loci/formats
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/DataTools.java

    r2178 r2438  
    3232 * 
    3333 * @author Curtis Rueden ctrueden at wisc.edu 
     34 * @author Chris Allan callan at blackcat.ca 
    3435 */ 
    3536public final class DataTools { 
     
    567568  } 
    568569 
     570  // -- Byte swapping -- 
     571 
     572  public static short swap(short x) { 
     573    return (short) ((x << 8) | ((x >> 8) & 0xFF)); 
     574  } 
     575 
     576  public static char swap(char x) { 
     577    return (char) ((x << 8) | ((x >> 8) & 0xFF)); 
     578  } 
     579 
     580  public static int swap(int x) { 
     581    return (int) ((swap((short) x) << 16) | (swap((short) (x >> 16)) & 0xFFFF)); 
     582  } 
     583 
     584  public static long swap(long x) { 
     585    return (long) (((long) swap((int) x) << 32) | 
     586      ((long) swap((int) (x >> 32)) & 0xFFFFFFFFL)); 
     587  } 
     588 
    569589} 
  • trunk/loci/formats/in/BaseTiffReader.java

    r2430 r2438  
    759759        ShortBuffer buf = ByteBuffer.wrap(byteArray).asShortBuffer(); 
    760760        for (int i = 0; i < (byteArray.length / 2); i++) { 
    761           buf.put(i, Bits.swap(buf.get(i))); 
     761          buf.put(i, DataTools.swap(buf.get(i))); 
    762762        } 
    763763      } 
Note: See TracChangeset for help on using the changeset viewer.