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
;
24 // ------------------------------------------------------------------------
26 // ------------------------------------------------------------------------
31 public final static int CTF_MAGIC
= 0xC1FC1FC1;
36 public final static int TSDL_MAGIC
= 0x75D11D57;
39 * TSDL magic number length in bytes.
41 public final static int TSDL_MAGIC_LEN
= 4;
44 * Directory separator on the current platform.
46 public final static String SEPARATOR
= System
.getProperty("file.separator"); //$NON-NLS-1$
49 * Length in bytes of a UUID value.
51 public final static int UUID_LEN
= 16;
53 // ------------------------------------------------------------------------
55 // ------------------------------------------------------------------------
58 * Unsigned long comparison.
64 * @return -1 if a < b, 1 if a > b, 0 if a == b.
66 public static int unsignedCompare(long a
, long b
) {
67 boolean aLeftBit
= (a
& (1 << (Long
.SIZE
- 1))) != 0;
68 boolean bLeftBit
= (b
& (1 << (Long
.SIZE
- 1))) != 0;
70 if (aLeftBit
&& !bLeftBit
) {
72 } else if (!aLeftBit
&& bLeftBit
) {
86 * Creates a UUID object from an array of 16 bytes.
90 * @return A UUID object.
92 public static UUID
makeUUID(byte bytes
[]) {
96 assert (bytes
.length
== Utils
.UUID_LEN
);
98 for (int i
= 0; i
< 8; i
++) {
99 low
= (low
<< 8) | (bytes
[i
+ 8] & 0xFF);
100 high
= (high
<< 8) | (bytes
[i
] & 0xFF);
103 UUID uuid
= new UUID(high
, low
);
This page took 0.040664 seconds and 6 git commands to generate.