Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
003fea5c
提交
003fea5c
authored
7 年前
作者:
LaughingMan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace MathUtils.compareLong() by Long.compare()
上级
87817179
隐藏空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
10 行增加
和
27 行删除
+10
-27
MultiVersionCursor.java
h2/src/main/org/h2/index/MultiVersionCursor.java
+1
-1
ConvertTraceFile.java
h2/src/main/org/h2/tools/ConvertTraceFile.java
+1
-1
MathUtils.java
h2/src/main/org/h2/util/MathUtils.java
+0
-12
ValueDate.java
h2/src/main/org/h2/value/ValueDate.java
+1
-2
ValueLong.java
h2/src/main/org/h2/value/ValueLong.java
+1
-2
ValueTime.java
h2/src/main/org/h2/value/ValueTime.java
+1
-2
ValueTimestamp.java
h2/src/main/org/h2/value/ValueTimestamp.java
+2
-3
ValueTimestampTimeZone.java
h2/src/main/org/h2/value/ValueTimestampTimeZone.java
+2
-3
ValueUuid.java
h2/src/main/org/h2/value/ValueUuid.java
+1
-1
没有找到文件。
h2/src/main/org/h2/index/MultiVersionCursor.java
浏览文件 @
003fea5c
...
@@ -143,7 +143,7 @@ public class MultiVersionCursor implements Cursor {
...
@@ -143,7 +143,7 @@ public class MultiVersionCursor implements Cursor {
// version would be compared as well
// version would be compared as well
long
k1
=
deltaRow
.
getKey
();
long
k1
=
deltaRow
.
getKey
();
long
k2
=
baseRow
.
getKey
();
long
k2
=
baseRow
.
getKey
();
compare
=
MathUtils
.
compareLong
(
k1
,
k2
);
compare
=
Long
.
compare
(
k1
,
k2
);
}
}
if
(
compare
==
0
)
{
if
(
compare
==
0
)
{
if
(
isDeleted
)
{
if
(
isDeleted
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/ConvertTraceFile.java
浏览文件 @
003fea5c
...
@@ -46,7 +46,7 @@ public class ConvertTraceFile extends Tool {
...
@@ -46,7 +46,7 @@ public class ConvertTraceFile extends Tool {
if
(
other
==
this
)
{
if
(
other
==
this
)
{
return
0
;
return
0
;
}
}
int
c
=
MathUtils
.
compareLong
(
other
.
time
,
time
);
int
c
=
Long
.
compare
(
other
.
time
,
time
);
if
(
c
==
0
)
{
if
(
c
==
0
)
{
c
=
MathUtils
.
compareInt
(
other
.
executeCount
,
executeCount
);
c
=
MathUtils
.
compareInt
(
other
.
executeCount
,
executeCount
);
if
(
c
==
0
)
{
if
(
c
==
0
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/MathUtils.java
浏览文件 @
003fea5c
...
@@ -291,18 +291,6 @@ public class MathUtils {
...
@@ -291,18 +291,6 @@ public class MathUtils {
return
a
==
b
?
0
:
a
<
b
?
-
1
:
1
;
return
a
==
b
?
0
:
a
<
b
?
-
1
:
1
;
}
}
/**
* Compare two values. Returns -1 if the first value is smaller, 1 if
* bigger, and 0 if equal.
*
* @param a the first value
* @param b the second value
* @return the result
*/
public
static
int
compareLong
(
long
a
,
long
b
)
{
return
a
==
b
?
0
:
a
<
b
?
-
1
:
1
;
}
/**
/**
* Get a cryptographically secure pseudo random long value.
* Get a cryptographically secure pseudo random long value.
*
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueDate.java
浏览文件 @
003fea5c
...
@@ -12,7 +12,6 @@ import java.sql.SQLException;
...
@@ -12,7 +12,6 @@ import java.sql.SQLException;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
/**
/**
...
@@ -121,7 +120,7 @@ public class ValueDate extends Value {
...
@@ -121,7 +120,7 @@ public class ValueDate extends Value {
@Override
@Override
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
return
MathUtils
.
compareLong
(
dateValue
,
((
ValueDate
)
o
).
dateValue
);
return
Long
.
compare
(
dateValue
,
((
ValueDate
)
o
).
dateValue
);
}
}
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueLong.java
浏览文件 @
003fea5c
...
@@ -12,7 +12,6 @@ import java.sql.SQLException;
...
@@ -12,7 +12,6 @@ import java.sql.SQLException;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.MathUtils
;
/**
/**
* Implementation of the BIGINT data type.
* Implementation of the BIGINT data type.
...
@@ -171,7 +170,7 @@ public class ValueLong extends Value {
...
@@ -171,7 +170,7 @@ public class ValueLong extends Value {
@Override
@Override
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
ValueLong
v
=
(
ValueLong
)
o
;
ValueLong
v
=
(
ValueLong
)
o
;
return
MathUtils
.
compareLong
(
value
,
v
.
value
);
return
Long
.
compare
(
value
,
v
.
value
);
}
}
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueTime.java
浏览文件 @
003fea5c
...
@@ -11,7 +11,6 @@ import java.sql.Time;
...
@@ -11,7 +11,6 @@ import java.sql.Time;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
/**
/**
...
@@ -129,7 +128,7 @@ public class ValueTime extends Value {
...
@@ -129,7 +128,7 @@ public class ValueTime extends Value {
@Override
@Override
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
return
MathUtils
.
compareLong
(
nanos
,
((
ValueTime
)
o
).
nanos
);
return
Long
.
compare
(
nanos
,
((
ValueTime
)
o
).
nanos
);
}
}
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueTimestamp.java
浏览文件 @
003fea5c
...
@@ -16,7 +16,6 @@ import org.h2.api.ErrorCode;
...
@@ -16,7 +16,6 @@ import org.h2.api.ErrorCode;
import
org.h2.engine.Mode
;
import
org.h2.engine.Mode
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.util.MathUtils
;
/**
/**
* Implementation of the TIMESTAMP data type.
* Implementation of the TIMESTAMP data type.
...
@@ -310,11 +309,11 @@ public class ValueTimestamp extends Value {
...
@@ -310,11 +309,11 @@ public class ValueTimestamp extends Value {
@Override
@Override
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
protected
int
compareSecure
(
Value
o
,
CompareMode
mode
)
{
ValueTimestamp
t
=
(
ValueTimestamp
)
o
;
ValueTimestamp
t
=
(
ValueTimestamp
)
o
;
int
c
=
MathUtils
.
compareLong
(
dateValue
,
t
.
dateValue
);
int
c
=
Long
.
compare
(
dateValue
,
t
.
dateValue
);
if
(
c
!=
0
)
{
if
(
c
!=
0
)
{
return
c
;
return
c
;
}
}
return
MathUtils
.
compareLong
(
timeNanos
,
t
.
timeNanos
);
return
Long
.
compare
(
timeNanos
,
t
.
timeNanos
);
}
}
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueTimestampTimeZone.java
浏览文件 @
003fea5c
...
@@ -14,7 +14,6 @@ import org.h2.api.ErrorCode;
...
@@ -14,7 +14,6 @@ import org.h2.api.ErrorCode;
import
org.h2.api.TimestampWithTimeZone
;
import
org.h2.api.TimestampWithTimeZone
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.util.DateTimeUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
/**
/**
...
@@ -310,14 +309,14 @@ public class ValueTimestampTimeZone extends Value {
...
@@ -310,14 +309,14 @@ public class ValueTimestampTimeZone extends Value {
b
-=
t
.
timeZoneOffsetMins
;
b
-=
t
.
timeZoneOffsetMins
;
// compare date
// compare date
int
c
=
MathUtils
.
compareLong
(
a
,
b
);
int
c
=
Long
.
compare
(
a
,
b
);
if
(
c
!=
0
)
{
if
(
c
!=
0
)
{
return
c
;
return
c
;
}
}
// compare time
// compare time
long
na
=
timeNanos
-
(
ma
*
1000L
*
1000L
*
1000L
*
60L
);
long
na
=
timeNanos
-
(
ma
*
1000L
*
1000L
*
1000L
*
60L
);
long
nb
=
t
.
timeNanos
-
(
mb
*
1000L
*
1000L
*
1000L
*
60L
);
long
nb
=
t
.
timeNanos
-
(
mb
*
1000L
*
1000L
*
1000L
*
60L
);
return
MathUtils
.
compareLong
(
na
,
nb
);
return
Long
.
compare
(
na
,
nb
);
}
}
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueUuid.java
浏览文件 @
003fea5c
...
@@ -159,7 +159,7 @@ public class ValueUuid extends Value {
...
@@ -159,7 +159,7 @@ public class ValueUuid extends Value {
}
}
ValueUuid
v
=
(
ValueUuid
)
o
;
ValueUuid
v
=
(
ValueUuid
)
o
;
if
(
high
==
v
.
high
)
{
if
(
high
==
v
.
high
)
{
return
MathUtils
.
compareLong
(
low
,
v
.
low
);
return
Long
.
compare
(
low
,
v
.
low
);
}
}
return
high
>
v
.
high
?
1
:
-
1
;
return
high
>
v
.
high
?
1
:
-
1
;
}
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论