Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
P
ParaEncode
Project
Project
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
Linshizhi
ParaEncode
Commits
5250a462
Commit
5250a462
authored
May 16, 2022
by
Linshizhi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
channel update
parent
b175c76d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
channel.js
src/channel.js
+8
-3
No files found.
src/channel.js
View file @
5250a462
...
@@ -340,27 +340,32 @@ export class Channel {
...
@@ -340,27 +340,32 @@ export class Channel {
}
}
#
readDataBlks
(
size
)
{
#
readDataBlks
(
size
)
{
let
buffer
=
undefined
;
let
endPos
=
this
.
#
endPos
-
1
;
let
endPos
=
this
.
#
endPos
-
1
;
let
buffer
=
new
Uint8Array
(
0
);
this
.
#
writePointerCache
=
this
.
#
getWritePointer
();
this
.
#
writePointerCache
=
this
.
#
getWritePointer
();
if
(
this
.
dataSize
()
<
size
)
if
(
this
.
dataSize
()
<
size
)
return
buffer
;
return
new
Uint8Array
(
0
)
;
let
blksRequired
=
Math
.
floor
(
size
/
this
.
#
blockSize
);
let
blksRequired
=
Math
.
floor
(
size
/
this
.
#
blockSize
);
if
(
blksRequired
==
0
)
{
if
(
blksRequired
==
0
)
{
return
buffer
;
return
new
Uint8Array
(
0
)
;
}
}
buffer
=
new
Uint8Array
(
blksRequired
*
this
.
#
blockSize
);
if
(
this
.
#
readPointerCache
>=
this
.
#
writePointerCache
)
{
if
(
this
.
#
readPointerCache
>=
this
.
#
writePointerCache
)
{
let
spaceBetweenEnd
=
endPos
-
this
.
#
readPointerCache
;
let
spaceBetweenEnd
=
endPos
-
this
.
#
readPointerCache
;
let
blks
=
Math
.
floor
(
spaceBetweenEnd
/
this
.
#
blockSize
);
let
blks
=
Math
.
floor
(
spaceBetweenEnd
/
this
.
#
blockSize
);
if
(
blks
>=
blksRequired
)
{
if
(
blks
>=
blksRequired
)
{
buffer
=
new
Uint8Array
(
blksRequired
*
this
.
#
blockSize
);
buffer
.
set
(
this
.
#
buffer
.
subarray
(
buffer
.
set
(
this
.
#
buffer
.
subarray
(
this
.
#
readPointerCache
,
this
.
#
readPointerCache
+
(
blksRequired
*
this
.
#
blockSize
)))
this
.
#
readPointerCache
,
this
.
#
readPointerCache
+
(
blksRequired
*
this
.
#
blockSize
)))
return
buffer
;
}
else
{
}
else
{
/* Two step to read datas */
}
}
}
else
if
(
this
.
#
readPointerCache
<
this
.
#
writePointerCache
)
{
}
else
if
(
this
.
#
readPointerCache
<
this
.
#
writePointerCache
)
{
...
...
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