mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8326941: Remove StringUTF16::isBigEndian
Reviewed-by: rriggs
This commit is contained in:
parent
6eea5d6755
commit
c59c41aa6e
2 changed files with 5 additions and 16 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -32,6 +32,8 @@ import java.util.function.Consumer;
|
||||||
import java.util.function.IntConsumer;
|
import java.util.function.IntConsumer;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import java.util.stream.StreamSupport;
|
import java.util.stream.StreamSupport;
|
||||||
|
|
||||||
|
import jdk.internal.misc.Unsafe;
|
||||||
import jdk.internal.util.ArraysSupport;
|
import jdk.internal.util.ArraysSupport;
|
||||||
import jdk.internal.util.DecimalDigits;
|
import jdk.internal.util.DecimalDigits;
|
||||||
import jdk.internal.vm.annotation.ForceInline;
|
import jdk.internal.vm.annotation.ForceInline;
|
||||||
|
@ -1658,12 +1660,10 @@ final class StringUTF16 {
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
private static native boolean isBigEndian();
|
|
||||||
|
|
||||||
private static final int HI_BYTE_SHIFT;
|
private static final int HI_BYTE_SHIFT;
|
||||||
private static final int LO_BYTE_SHIFT;
|
private static final int LO_BYTE_SHIFT;
|
||||||
static {
|
static {
|
||||||
if (isBigEndian()) {
|
if (Unsafe.getUnsafe().isBigEndian()) {
|
||||||
HI_BYTE_SHIFT = 8;
|
HI_BYTE_SHIFT = 8;
|
||||||
LO_BYTE_SHIFT = 0;
|
LO_BYTE_SHIFT = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -31,14 +31,3 @@ Java_java_lang_String_intern(JNIEnv *env, jobject this)
|
||||||
{
|
{
|
||||||
return JVM_InternString(env, this);
|
return JVM_InternString(env, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
JNIEXPORT jboolean JNICALL
|
|
||||||
Java_java_lang_StringUTF16_isBigEndian(JNIEnv *env, jclass cls)
|
|
||||||
{
|
|
||||||
unsigned int endianTest = 0xff000000;
|
|
||||||
if (((char*)(&endianTest))[0] != 0) {
|
|
||||||
return JNI_TRUE;
|
|
||||||
} else {
|
|
||||||
return JNI_FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue