Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
db50e427
Commit
db50e427
authored
Oct 29, 2000
by
Bryce McKinlay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-indent in preparation for diff.
From-SVN: r37114
parent
7d3af72b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
120 additions
and
120 deletions
+120
-120
libjava/java/util/BitSet.java
+120
-120
No files found.
libjava/java/util/BitSet.java
View file @
db50e427
...
@@ -4,9 +4,9 @@
...
@@ -4,9 +4,9 @@
This file is part of libgcj.
This file is part of libgcj.
This software is copyrighted work licensed under the terms of the
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
details. */
package
java
.
util
;
package
java
.
util
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -23,154 +23,154 @@ import java.io.Serializable;
...
@@ -23,154 +23,154 @@ import java.io.Serializable;
public
final
class
BitSet
implements
Cloneable
,
Serializable
public
final
class
BitSet
implements
Cloneable
,
Serializable
{
{
public
void
and
(
BitSet
bs
)
public
void
and
(
BitSet
bs
)
{
{
int
max
=
Math
.
min
(
bits
.
length
,
bs
.
bits
.
length
);
int
max
=
Math
.
min
(
bits
.
length
,
bs
.
bits
.
length
);
int
i
;
int
i
;
for
(
i
=
0
;
i
<
max
;
++
i
)
for
(
i
=
0
;
i
<
max
;
++
i
)
bits
[
i
]
&=
bs
.
bits
[
i
];
bits
[
i
]
&=
bs
.
bits
[
i
];
for
(
;
i
<
bits
.
length
;
++
i
)
for
(
;
i
<
bits
.
length
;
++
i
)
bits
[
i
]
=
0
;
bits
[
i
]
=
0
;
}
}
public
BitSet
()
public
BitSet
()
{
{
this
(
64
);
this
(
64
);
}
}
public
BitSet
(
int
nbits
)
public
BitSet
(
int
nbits
)
{
{
if
(
nbits
<
0
)
if
(
nbits
<
0
)
throw
new
NegativeArraySizeException
();
throw
new
NegativeArraySizeException
();
int
length
=
nbits
/
64
;
int
length
=
nbits
/
64
;
if
(
nbits
%
64
!=
0
)
if
(
nbits
%
64
!=
0
)
++
length
;
++
length
;
bits
=
new
long
[
length
];
bits
=
new
long
[
length
];
}
}
public
void
clear
(
int
pos
)
public
void
clear
(
int
pos
)
{
{
if
(
pos
<
0
)
if
(
pos
<
0
)
throw
new
IndexOutOfBoundsException
();
throw
new
IndexOutOfBoundsException
();
int
bit
=
pos
%
64
;
int
bit
=
pos
%
64
;
int
offset
=
pos
/
64
;
int
offset
=
pos
/
64
;
ensure
(
offset
);
ensure
(
offset
);
bits
[
offset
]
&=
~
(
1L
<<
bit
);
bits
[
offset
]
&=
~
(
1L
<<
bit
);
}
}
public
Object
clone
()
public
Object
clone
()
{
{
BitSet
bs
=
new
BitSet
(
bits
.
length
*
64
);
BitSet
bs
=
new
BitSet
(
bits
.
length
*
64
);
System
.
arraycopy
(
bits
,
0
,
bs
.
bits
,
0
,
bits
.
length
);
System
.
arraycopy
(
bits
,
0
,
bs
.
bits
,
0
,
bits
.
length
);
return
bs
;
return
bs
;
}
}
public
boolean
equals
(
Object
obj
)
public
boolean
equals
(
Object
obj
)
{
{
if
(!
(
obj
instanceof
BitSet
))
if
(!(
obj
instanceof
BitSet
))
return
false
;
BitSet
bs
=
(
BitSet
)
obj
;
int
max
=
Math
.
min
(
bits
.
length
,
bs
.
bits
.
length
);
int
i
;
for
(
i
=
0
;
i
<
max
;
++
i
)
if
(
bits
[
i
]
!=
bs
.
bits
[
i
])
return
false
;
return
false
;
BitSet
bs
=
(
BitSet
)
obj
;
// If one is larger, check to make sure all extra bits are 0.
int
max
=
Math
.
min
(
bits
.
length
,
bs
.
bits
.
length
);
for
(
int
j
=
i
;
j
<
bits
.
length
;
++
j
)
int
i
;
if
(
bits
[
j
]
!=
0
)
for
(
i
=
0
;
i
<
max
;
++
i
)
return
false
;
if
(
bits
[
i
]
!=
bs
.
bits
[
i
])
for
(
int
j
=
i
;
j
<
bs
.
bits
.
length
;
++
j
)
return
false
;
if
(
bs
.
bits
[
j
]
!=
0
)
// If one is larger, check to make sure all extra bits are 0.
return
false
;
for
(
int
j
=
i
;
j
<
bits
.
length
;
++
j
)
return
true
;
if
(
bits
[
j
]
!=
0
)
}
return
false
;
for
(
int
j
=
i
;
j
<
bs
.
bits
.
length
;
++
j
)
if
(
bs
.
bits
[
j
]
!=
0
)
return
false
;
return
true
;
}
public
boolean
get
(
int
pos
)
public
boolean
get
(
int
pos
)
{
{
if
(
pos
<
0
)
if
(
pos
<
0
)
throw
new
IndexOutOfBoundsException
();
throw
new
IndexOutOfBoundsException
();
int
bit
=
pos
%
64
;
int
bit
=
pos
%
64
;
int
offset
=
pos
/
64
;
int
offset
=
pos
/
64
;
if
(
offset
>=
bits
.
length
)
if
(
offset
>=
bits
.
length
)
return
false
;
return
false
;
return
(
bits
[
offset
]
&
(
1L
<<
bit
))
==
0
?
false
:
true
;
return
(
bits
[
offset
]
&
(
1L
<<
bit
))
==
0
?
false
:
true
;
}
}
public
int
hashCode
()
public
int
hashCode
()
{
{
long
h
=
1234
;
long
h
=
1234
;
for
(
int
i
=
bits
.
length
-
1
;
i
>=
0
;
--
i
)
for
(
int
i
=
bits
.
length
-
1
;
i
>=
0
;
--
i
)
h
^=
bits
[
i
]
*
(
i
+
1
);
h
^=
bits
[
i
]
*
(
i
+
1
);
return
(
int
)
((
h
>>
32
)
^
h
);
return
(
int
)
((
h
>>
32
)
^
h
);
}
}
public
void
or
(
BitSet
bs
)
public
void
or
(
BitSet
bs
)
{
{
ensure
(
bs
.
bits
.
length
-
1
);
ensure
(
bs
.
bits
.
length
-
1
);
int
i
;
int
i
;
for
(
i
=
0
;
i
<
bs
.
bits
.
length
;
++
i
)
for
(
i
=
0
;
i
<
bs
.
bits
.
length
;
++
i
)
bits
[
i
]
|=
bs
.
bits
[
i
];
bits
[
i
]
|=
bs
.
bits
[
i
];
}
}
public
void
set
(
int
pos
)
public
void
set
(
int
pos
)
{
{
if
(
pos
<
0
)
if
(
pos
<
0
)
throw
new
IndexOutOfBoundsException
();
throw
new
IndexOutOfBoundsException
();
int
bit
=
pos
%
64
;
int
bit
=
pos
%
64
;
int
offset
=
pos
/
64
;
int
offset
=
pos
/
64
;
ensure
(
offset
);
ensure
(
offset
);
bits
[
offset
]
|=
1L
<<
bit
;
bits
[
offset
]
|=
1L
<<
bit
;
}
}
public
int
size
()
public
int
size
()
{
{
return
bits
.
length
*
64
;
return
bits
.
length
*
64
;
}
}
public
String
toString
()
public
String
toString
()
{
{
StringBuffer
result
=
new
StringBuffer
(
"{"
);
StringBuffer
result
=
new
StringBuffer
(
"{"
);
boolean
first
=
true
;
boolean
first
=
true
;
for
(
int
i
=
0
;
i
<
bits
.
length
;
++
i
)
for
(
int
i
=
0
;
i
<
bits
.
length
;
++
i
)
{
{
int
bit
=
1
;
int
bit
=
1
;
long
word
=
bits
[
i
];
long
word
=
bits
[
i
];
for
(
int
j
=
0
;
j
<
64
;
++
j
)
for
(
int
j
=
0
;
j
<
64
;
++
j
)
{
{
if
((
word
&
bit
)
!=
0
)
if
((
word
&
bit
)
!=
0
)
{
{
if
(!
first
)
if
(!
first
)
result
.
append
(
", "
);
result
.
append
(
", "
);
result
.
append
(
64
*
i
+
j
);
result
.
append
(
64
*
i
+
j
);
first
=
false
;
first
=
false
;
}
}
bit
<<=
1
;
bit
<<=
1
;
}
}
}
}
return
result
.
append
(
"}"
).
toString
();
return
result
.
append
(
"}"
).
toString
();
}
}
public
void
xor
(
BitSet
bs
)
public
void
xor
(
BitSet
bs
)
{
{
ensure
(
bs
.
bits
.
length
-
1
);
ensure
(
bs
.
bits
.
length
-
1
);
int
i
;
int
i
;
for
(
i
=
0
;
i
<
bs
.
bits
.
length
;
++
i
)
for
(
i
=
0
;
i
<
bs
.
bits
.
length
;
++
i
)
bits
[
i
]
^=
bs
.
bits
[
i
];
bits
[
i
]
^=
bs
.
bits
[
i
];
}
}
// Make sure the vector is big enough.
// Make sure the vector is big enough.
private
final
void
ensure
(
int
lastElt
)
private
final
void
ensure
(
int
lastElt
)
{
{
if
(
lastElt
+
1
>
bits
.
length
)
if
(
lastElt
+
1
>
bits
.
length
)
{
{
long
[]
nd
=
new
long
[
lastElt
+
1
];
long
[]
nd
=
new
long
[
lastElt
+
1
];
System
.
arraycopy
(
bits
,
0
,
nd
,
0
,
bits
.
length
);
System
.
arraycopy
(
bits
,
0
,
nd
,
0
,
bits
.
length
);
bits
=
nd
;
bits
=
nd
;
}
}
}
}
// The actual bits.
// The actual bits.
private
long
[]
bits
;
private
long
[]
bits
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment