1 28 29 package com.caucho.db.index; 30 31 34 public class IntKeyCompare extends KeyCompare { 35 38 public int compare(byte []keyBuffer, int keyOffset, 39 byte []block, int offset, int length) 40 { 41 int key = (((keyBuffer[keyOffset + 0] & 0xff) << 24) + 42 ((keyBuffer[keyOffset + 1] & 0xff) << 16) + 43 ((keyBuffer[keyOffset + 2] & 0xff) << 8) + 44 ((keyBuffer[keyOffset + 3] & 0xff) << 0)); 45 46 int value = (((block[offset + 0] & 0xff) << 24) + 47 ((block[offset + 1] & 0xff) << 16) + 48 ((block[offset + 2] & 0xff) << 8) + 49 ((block[offset + 3] & 0xff) << 0)); 50 51 if (key == value) 52 return 0; 53 else if (key < value) 54 return -1; 55 else 56 return 1; 57 } 58 } 59 | Popular Tags |