1 /*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
4 * All rights reserved. This program and the accompanying materials are made
5 * available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.ctf
.core
.trace
;
15 import java
.util
.UUID
;
21 * @author Matthew Khouzam
22 * @author Simon Marchi
26 // ------------------------------------------------------------------------
28 // ------------------------------------------------------------------------
31 * CTF magic number. (sort of looks like CTF CTF CT)
33 public final static int CTF_MAGIC
= 0xC1FC1FC1;
36 * TSDL magic number. (sort of looks like TSDL LSDT)
38 public final static int TSDL_MAGIC
= 0x75D11D57;
41 * TSDL magic number length in bytes.
43 public final static int TSDL_MAGIC_LEN
= 4;
46 * Directory separator on the current platform.
48 public final static String SEPARATOR
= System
.getProperty("file.separator"); //$NON-NLS-1$
51 * Length in bytes of a UUID value.
53 public final static int UUID_LEN
= 16;
55 // ------------------------------------------------------------------------
57 // ------------------------------------------------------------------------
60 * Unsigned long comparison.
66 * @return -1 if a < b, 1 if a > b, 0 if a == b.
68 public static int unsignedCompare(long a
, long b
) {
69 boolean aLeftBit
= (a
& (1 << (Long
.SIZE
- 1))) != 0;
70 boolean bLeftBit
= (b
& (1 << (Long
.SIZE
- 1))) != 0;
72 if (aLeftBit
&& !bLeftBit
) {
74 } else if (!aLeftBit
&& bLeftBit
) {
88 * Creates a UUID object from an array of 16 bytes.
92 * @return A UUID object.
94 public static UUID
makeUUID(byte bytes
[]) {
98 assert (bytes
.length
== Utils
.UUID_LEN
);
100 for (int i
= 0; i
< 8; i
++) {
101 low
= (low
<< 8) | (bytes
[i
+ 8] & 0xFF);
102 high
= (high
<< 8) | (bytes
[i
] & 0xFF);
105 UUID uuid
= new UUID(high
, low
);
This page took 0.03461 seconds and 6 git commands to generate.