Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
255cf71a
Commit
255cf71a
authored
Dec 06, 2004
by
joreland@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - Use BitmaskImpl in TUP (in BitField operations)
parent
836e13ae
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
68 deletions
+88
-68
ndb/include/util/Bitmask.hpp
ndb/include/util/Bitmask.hpp
+47
-0
ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
+41
-68
No files found.
ndb/include/util/Bitmask.hpp
View file @
255cf71a
...
@@ -131,6 +131,19 @@ public:
...
@@ -131,6 +131,19 @@ public:
static
void
setField
(
unsigned
size
,
Uint32
data
[],
static
void
setField
(
unsigned
size
,
Uint32
data
[],
unsigned
pos
,
unsigned
len
,
Uint32
val
);
unsigned
pos
,
unsigned
len
,
Uint32
val
);
/**
* getField - Get bitfield at given position and length
*/
static
void
getField
(
unsigned
size
,
const
Uint32
data
[],
unsigned
pos
,
unsigned
len
,
Uint32
dst
[]);
/**
* setField - Set bitfield at given position and length
*/
static
void
setField
(
unsigned
size
,
Uint32
data
[],
unsigned
pos
,
unsigned
len
,
const
Uint32
src
[]);
/**
/**
* getText - Return as hex-digits (only for debug routines).
* getText - Return as hex-digits (only for debug routines).
*/
*/
...
@@ -794,4 +807,38 @@ public:
...
@@ -794,4 +807,38 @@ public:
Bitmask
()
{
this
->
clear
();}
Bitmask
()
{
this
->
clear
();}
};
};
inline
void
BitmaskImpl
::
getField
(
unsigned
size
,
const
Uint32
data
[],
unsigned
pos
,
unsigned
len
,
Uint32
dst
[])
{
assert
(
len
>
0
);
assert
(
pos
+
len
<
(
size
<<
5
));
Uint32
word
=
pos
>>
5
;
Uint32
offset
=
pos
&
31
;
if
(
offset
+
len
<=
32
)
{
dst
[
0
]
=
(
data
[
word
]
>>
offset
)
&
((
1
<<
len
)
-
1
);
return
;
}
abort
();
}
inline
void
BitmaskImpl
::
setField
(
unsigned
size
,
Uint32
data
[],
unsigned
pos
,
unsigned
len
,
const
Uint32
src
[])
{
assert
(
len
>
0
);
assert
(
pos
+
len
<
(
size
<<
5
));
Uint32
word
=
pos
>>
5
;
Uint32
offset
=
pos
&
31
;
if
(
offset
+
len
<=
32
)
{
Uint32
mask
=
((
1
<<
len
)
-
1
)
<<
offset
;
data
[
word
]
=
(
data
[
word
]
&
~
mask
)
|
((
src
[
0
]
<<
offset
)
&
mask
);
return
;
}
abort
();
}
#endif
#endif
ndb/src/kernel/blocks/dbtup/DbtupRoutines.cpp
View file @
255cf71a
...
@@ -1028,22 +1028,22 @@ Dbtup::readBitsNotNULL(Uint32* outBuffer,
...
@@ -1028,22 +1028,22 @@ Dbtup::readBitsNotNULL(Uint32* outBuffer,
offsetInTuple
+=
regTabPtr
->
tupNullIndex
;
offsetInTuple
+=
regTabPtr
->
tupNullIndex
;
ndbrequire
(
offsetInTuple
<
tCheckOffset
);
ndbrequire
(
offsetInTuple
<
tCheckOffset
);
Uint32
pos
=
offsetInTuple
<<
5
+
offsetInWord
;
Uint32
indexBuf
=
tOutBufIndex
;
Uint32
indexBuf
=
tOutBufIndex
;
Uint32
newIndexBuf
=
indexBuf
+
((
bitCount
+
31
)
>>
5
);
Uint32
newIndexBuf
=
indexBuf
+
((
bitCount
+
31
)
>>
5
);
Uint32
maxRead
=
tMaxRead
;
Uint32
maxRead
=
tMaxRead
;
outBuffer
[
indexBuf
]
=
(
tTupleHeader
[
offsetInTuple
]
>>
offsetInWord
)
&
((
1
<<
bitCount
)
-
1
);
if
(
offsetInWord
+
bitCount
>
32
)
{
ndbrequire
(
false
);
}
if
(
newIndexBuf
<=
maxRead
)
{
if
(
newIndexBuf
<=
maxRead
)
{
ljam
();
ljam
();
ahOut
->
setDataSize
((
bitCount
+
31
)
>>
5
);
ahOut
->
setDataSize
((
bitCount
+
31
)
>>
5
);
tOutBufIndex
=
newIndexBuf
;
tOutBufIndex
=
newIndexBuf
;
BitmaskImpl
::
getField
(
regTabPtr
->
tupNullWords
,
tTupleHeader
+
regTabPtr
->
tupNullIndex
,
pos
,
bitCount
,
outBuffer
+
indexBuf
);
return
true
;
return
true
;
}
else
{
}
else
{
ljam
();
ljam
();
...
@@ -1069,34 +1069,27 @@ Dbtup::readBitsNULLable(Uint32* outBuffer,
...
@@ -1069,34 +1069,27 @@ Dbtup::readBitsNULLable(Uint32* outBuffer,
Uint32
indexBuf
=
tOutBufIndex
;
Uint32
indexBuf
=
tOutBufIndex
;
Uint32
newIndexBuf
=
indexBuf
+
(
bitCount
+
31
)
>>
5
;
Uint32
newIndexBuf
=
indexBuf
+
(
bitCount
+
31
)
>>
5
;
Uint32
maxRead
=
tMaxRead
;
Uint32
maxRead
=
tMaxRead
;
Uint32
pos
=
offsetInWord
<<
5
+
offsetInTuple
;
if
((
tTupleHeader
[
offsetInTuple
]
>>
offsetInWord
)
&
1
)
if
(
BitmaskImpl
::
get
(
regTabPtr
->
tupNullWords
,
tTupleHeader
+
regTabPtr
->
tupNullIndex
,
pos
))
{
{
ljam
();
ljam
();
ahOut
->
setNULL
();
ahOut
->
setNULL
();
return
true
;
return
true
;
}
}
offsetInWord
++
;
if
(
offsetInWord
==
32
)
{
ljam
();
offsetInWord
=
0
;
offsetInTuple
++
;
}
outBuffer
[
indexBuf
]
=
(
tTupleHeader
[
offsetInTuple
]
>>
offsetInWord
)
&
((
1
<<
bitCount
)
-
1
);
if
(
offsetInWord
+
bitCount
>
32
)
{
ndbrequire
(
false
);
}
if
(
newIndexBuf
<=
maxRead
)
{
if
(
newIndexBuf
<=
maxRead
)
{
ljam
();
ljam
();
ahOut
->
setDataSize
((
bitCount
+
31
)
>>
5
);
ahOut
->
setDataSize
((
bitCount
+
31
)
>>
5
);
tOutBufIndex
=
newIndexBuf
;
tOutBufIndex
=
newIndexBuf
;
BitmaskImpl
::
getField
(
regTabPtr
->
tupNullWords
,
tTupleHeader
+
regTabPtr
->
tupNullIndex
,
pos
+
1
,
bitCount
,
outBuffer
+
indexBuf
);
return
true
;
return
true
;
}
else
{
}
else
{
ljam
();
ljam
();
...
@@ -1123,24 +1116,16 @@ Dbtup::updateBitsNotNULL(Uint32* inBuffer,
...
@@ -1123,24 +1116,16 @@ Dbtup::updateBitsNotNULL(Uint32* inBuffer,
ndbrequire
((
nullFlagOffset
<
regTabPtr
->
tupNullWords
)
&&
ndbrequire
((
nullFlagOffset
<
regTabPtr
->
tupNullWords
)
&&
(
nullWordOffset
<
tCheckOffset
));
(
nullWordOffset
<
tCheckOffset
));
Uint32
nullBits
=
tTupleHeader
[
nullWordOffset
];
Uint32
nullBits
=
tTupleHeader
[
nullWordOffset
];
Uint32
pos
=
(
nullFlagOffset
<<
5
)
+
nullFlagBitOffset
;
if
(
newIndex
<=
inBufLen
)
{
if
(
newIndex
<=
inBufLen
)
{
Uint32
updateWord
=
inBuffer
[
indexBuf
+
1
];
if
(
!
nullIndicator
)
{
if
(
!
nullIndicator
)
{
BitmaskImpl
::
setField
(
regTabPtr
->
tupNullWords
,
tTupleHeader
+
regTabPtr
->
tupNullIndex
,
pos
,
bitCount
,
inBuffer
+
indexBuf
+
1
);
tInBufIndex
=
newIndex
;
tInBufIndex
=
newIndex
;
Uint32
mask
=
((
1
<<
bitCount
)
-
1
)
<<
nullFlagBitOffset
;
if
(
nullFlagBitOffset
+
bitCount
<=
32
)
{
ljam
();
tTupleHeader
[
nullWordOffset
]
=
(
nullBits
&
~
mask
)
|
((
updateWord
<<
nullFlagBitOffset
)
&
mask
);
return
true
;
}
else
{
abort
();
}
return
true
;
return
true
;
}
else
{
}
else
{
ljam
();
ljam
();
...
@@ -1171,41 +1156,29 @@ Dbtup::updateBitsNULLable(Uint32* inBuffer,
...
@@ -1171,41 +1156,29 @@ Dbtup::updateBitsNULLable(Uint32* inBuffer,
(
nullWordOffset
<
tCheckOffset
));
(
nullWordOffset
<
tCheckOffset
));
Uint32
nullBits
=
tTupleHeader
[
nullWordOffset
];
Uint32
nullBits
=
tTupleHeader
[
nullWordOffset
];
Uint32
bitCount
=
AttributeDescriptor
::
getArraySize
(
attrDescriptor
);
Uint32
bitCount
=
AttributeDescriptor
::
getArraySize
(
attrDescriptor
);
Uint32
pos
=
(
nullFlagOffset
<<
5
)
+
nullFlagBitOffset
;
if
(
!
nullIndicator
)
{
if
(
!
nullIndicator
)
{
Uint32
newIndex
=
indexBuf
+
1
+
((
bitCount
+
31
)
>>
5
);
BitmaskImpl
::
clear
(
regTabPtr
->
tupNullWords
,
nullBits
&=
(
~
(
1
<<
nullFlagBitOffset
));
tTupleHeader
+
regTabPtr
->
tupNullIndex
,
ljam
();
pos
);
tTupleHeader
[
nullWordOffset
]
=
nullBits
;
BitmaskImpl
::
setField
(
regTabPtr
->
tupNullWords
,
tTupleHeader
+
regTabPtr
->
tupNullIndex
,
nullFlagBitOffset
++
;
pos
+
1
,
if
(
nullFlagBitOffset
==
32
)
bitCount
,
{
inBuffer
+
indexBuf
+
1
);
ljam
();
nullFlagBitOffset
=
0
;
nullWordOffset
++
;
nullBits
=
tTupleHeader
[
nullWordOffset
];
}
Uint32
updateWord
=
inBuffer
[
indexBuf
+
1
];
Uint32
newIndex
=
indexBuf
+
1
+
((
bitCount
+
31
)
>>
5
);
Uint32
mask
=
((
1
<<
bitCount
)
-
1
)
<<
nullFlagBitOffset
;
tInBufLen
=
newIndex
;
tInBufLen
=
newIndex
;
if
(
nullFlagBitOffset
+
bitCount
<=
32
)
{
ljam
();
tTupleHeader
[
nullWordOffset
]
=
(
nullBits
&
~
mask
)
|
((
updateWord
<<
nullFlagBitOffset
)
&
mask
);
return
true
;
return
true
;
}
abort
();
}
else
{
}
else
{
Uint32
newIndex
=
tInBufIndex
+
1
;
Uint32
newIndex
=
tInBufIndex
+
1
;
if
(
newIndex
<=
tInBufLen
)
{
if
(
newIndex
<=
tInBufLen
)
{
nullBits
|=
(
1
<<
nullFlagBitOffset
);
ljam
();
ljam
();
tTupleHeader
[
nullWordOffset
]
=
nullBits
;
BitmaskImpl
::
set
(
regTabPtr
->
tupNullWords
,
tTupleHeader
+
regTabPtr
->
tupNullIndex
,
pos
);
tInBufIndex
=
newIndex
;
tInBufIndex
=
newIndex
;
return
true
;
return
true
;
}
else
{
}
else
{
...
...
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