78 public static byte[]
getBytes(
short s,
bool asc)
80 byte[] buf =
new byte[2];
83 for (
int i = buf.Length - 1; i >= 0; i--)
85 buf[i] = (byte) (s & 0x00ff);
91 for (
int i = 0; i < buf.Length; i++)
94 buf[i] = (byte) (s & 0x00ff);
102 byte[] buf =
new byte[4];
104 for (
int i = buf.Length - 1; i >= 0; i--)
106 buf[i] = (byte) (s & 0x000000ff);
110 for (
int i = 0; i < buf.Length; i++)
112 buf[i] = (byte) (s & 0x000000ff);
120 byte[] buf =
new byte[8];
122 for (
int i = buf.Length - 1; i >= 0; i--)
124 buf[i] = (byte) (s & 0x00000000000000ff);
128 for (
int i = 0; i < buf.Length; i++)
130 buf[i] = (byte) (s & 0x00000000000000ff);
135 public static short getShort(byte[] buf,
bool asc) {
139 if (buf.Length > 2) {
144 for (
int i = buf.Length - 1; i >= 0; i--) {
146 r |= (short)(buf[i] & 0x00ff);
149 for (
int i = 0; i < buf.Length; i++) {
151 r |= (short)(buf[i] & 0x00ff);
155 public static int getInt(byte[] buf,
bool asc) {
159 if (buf.Length > 4) {
164 for (
int i = buf.Length - 1; i >= 0; i--) {
166 r |= (buf[i] & 0x000000ff);
169 for (
int i = 0; i < buf.Length; i++) {
171 r |= (buf[i] & 0x000000ff);
175 public static long getLong(byte[] buf,
bool asc) {
179 if (buf.Length > 8) {
184 for (
int i = buf.Length - 1; i >= 0; i--) {
186 r |= (buf[i] & (uint)0x00000000000000ff);
189 for (
int i = 0; i < buf.Length; i++) {
191 r |= (buf[i] & (uint)0x00000000000000ff);
static byte[] getBytes(int s, bool asc)
static short getShort(byte[] buf, bool asc)
static int getInt(byte[] buf, bool asc)
static byte[] getBytes(long s, bool asc)
static long getLong(byte[] buf, bool asc)
static byte[] getBytes(short s, bool asc)