bytes_sparc.hpp revision 1472
1472N/A * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A // Efficient reading and writing of unaligned unsigned data in platform-specific byte ordering 0N/A // Sparc needs to check for alignment. 0N/A // can I count on address always being a pointer to an unsigned char? Yes 0N/A // Returns true, if the byte ordering used by Java is different from the nativ byte ordering 0N/A // of the underlying machine. For example, true for Intel x86, False, for Solaris on Sparc. 0N/A // Thus, a swap between native and Java ordering is always a no-op: 0N/A case 2:
return (
u4( ((
u2*)p)[0] ) <<
16 )
0N/A default:
return (
u4(p[0]) <<
24 )
0N/A case 4:
return (
u8( ((
u4*)p)[0] ) <<
32 )
0N/A case 2:
return (
u8( ((
u2*)p)[0] ) <<
48 )
0N/A default:
return (
u8(p[0]) <<
56 )
0N/A case 2: ((
u2*)p)[0] = x >>
16;
0N/A default: ((
u1*)p)[0] = x >>
24;
0N/A case 4: ((
u4*)p)[0] = x >>
32;
0N/A case 2: ((
u2*)p)[0] = x >>
48;
0N/A default: ((
u1*)p)[0] = x >>
56;
0N/A // Efficient reading and writing of unaligned unsigned data in Java byte ordering (i.e. big-endian ordering) 0N/A // (no byte-order reversal is needed since SPARC CPUs are big-endian oriented) 0N/A//Reconciliation History