mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Refactor code for improved readability and maintainability
- Simplified multi-line function calls in `PatchTree.lua` and `SHA1.luau` for better clarity. - Enhanced the `init.lua` file by formatting the `PatchTree.build` function call across multiple lines. - Updated `change_processor.rs` and `api.rs` to improve the formatting of function calls and enhance code consistency. - Made minor adjustments in test files to streamline assertions and improve readability. These changes contribute to a cleaner codebase and enhance overall maintainability.
This commit is contained in:
parent
91c599ecca
commit
6dec06865f
7 changed files with 111 additions and 96 deletions
|
|
@ -868,7 +868,12 @@ function App:startSession()
|
|||
})
|
||||
self:setState({
|
||||
appStatus = AppStatus.Confirming,
|
||||
patchTree = PatchTree.build(patch, instanceMap, { "Property", "Current", "Incoming" }, serverInfo.gitMetadata),
|
||||
patchTree = PatchTree.build(
|
||||
patch,
|
||||
instanceMap,
|
||||
{ "Property", "Current", "Incoming" },
|
||||
serverInfo.gitMetadata
|
||||
),
|
||||
confirmData = {
|
||||
serverInfo = serverInfo,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -319,8 +319,7 @@ function PatchTree.build(patch, instanceMap, changeListHeaders, gitMetadata)
|
|||
if changedIdSet then
|
||||
if not changedIdSet[change.id] then
|
||||
defaultSelection = "pull"
|
||||
elseif instance:IsA("LuaSourceContainer")
|
||||
and gitMetadata.scriptCommittedHashes then
|
||||
elseif instance:IsA("LuaSourceContainer") and gitMetadata.scriptCommittedHashes then
|
||||
local hashes = gitMetadata.scriptCommittedHashes[change.id]
|
||||
if hashes then
|
||||
local source = instance.Source
|
||||
|
|
|
|||
|
|
@ -33,50 +33,55 @@ local function DigestBlocks(Blocks: buffer, Length: number): (number, number, nu
|
|||
end
|
||||
|
||||
for Index = 64, 316, 4 do
|
||||
buffer.writeu32(Offsets, Index, bit32.lrotate(bit32.bxor(
|
||||
buffer.readu32(Offsets, Index - 12),
|
||||
buffer.readu32(Offsets, Index - 32),
|
||||
buffer.readu32(Offsets, Index - 56),
|
||||
buffer.readu32(Offsets, Index - 64)
|
||||
), 1))
|
||||
buffer.writeu32(
|
||||
Offsets,
|
||||
Index,
|
||||
bit32.lrotate(
|
||||
bit32.bxor(
|
||||
buffer.readu32(Offsets, Index - 12),
|
||||
buffer.readu32(Offsets, Index - 32),
|
||||
buffer.readu32(Offsets, Index - 56),
|
||||
buffer.readu32(Offsets, Index - 64)
|
||||
),
|
||||
1
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
local H1, H2, H3, H4, H5 = A, B, C, D, E
|
||||
|
||||
|
||||
local Temp
|
||||
for Round = 0, 19 do
|
||||
Temp = bit32.lrotate(H1, 5) +
|
||||
bit32.band(H2, H3) + bit32.band(-1 - H2, H4) +
|
||||
H5 + 0x5a827999 +
|
||||
buffer.readu32(Offsets, Round * 4)
|
||||
|
||||
Temp = bit32.lrotate(H1, 5)
|
||||
+ bit32.band(H2, H3)
|
||||
+ bit32.band(-1 - H2, H4)
|
||||
+ H5
|
||||
+ 0x5a827999
|
||||
+ buffer.readu32(Offsets, Round * 4)
|
||||
|
||||
H5, H4, H3, H2, H1 = H4, H3, bit32.lrotate(H2, 30), H1, Temp
|
||||
end
|
||||
|
||||
|
||||
for Round = 20, 39 do
|
||||
Temp = bit32.lrotate(H1, 5) +
|
||||
bit32.bxor(H2, H3, H4) +
|
||||
H5 + 0x6ed9eba1 +
|
||||
buffer.readu32(Offsets, Round * 4)
|
||||
|
||||
Temp = bit32.lrotate(H1, 5) + bit32.bxor(H2, H3, H4) + H5 + 0x6ed9eba1 + buffer.readu32(Offsets, Round * 4)
|
||||
|
||||
H5, H4, H3, H2, H1 = H4, H3, bit32.lrotate(H2, 30), H1, Temp
|
||||
end
|
||||
|
||||
|
||||
for Round = 40, 59 do
|
||||
Temp = bit32.lrotate(H1, 5) +
|
||||
bit32.band(H4, H3) + bit32.band(H2, bit32.bxor(H4, H3)) +
|
||||
H5 + 0x8f1bbcdc +
|
||||
buffer.readu32(Offsets, Round * 4)
|
||||
|
||||
Temp = bit32.lrotate(H1, 5)
|
||||
+ bit32.band(H4, H3)
|
||||
+ bit32.band(H2, bit32.bxor(H4, H3))
|
||||
+ H5
|
||||
+ 0x8f1bbcdc
|
||||
+ buffer.readu32(Offsets, Round * 4)
|
||||
|
||||
H5, H4, H3, H2, H1 = H4, H3, bit32.lrotate(H2, 30), H1, Temp
|
||||
end
|
||||
|
||||
|
||||
for Round = 60, 79 do
|
||||
Temp = bit32.lrotate(H1, 5) +
|
||||
bit32.bxor(H2, H3, H4) +
|
||||
H5 + 0xca62c1d6 +
|
||||
buffer.readu32(Offsets, Round * 4)
|
||||
|
||||
Temp = bit32.lrotate(H1, 5) + bit32.bxor(H2, H3, H4) + H5 + 0xca62c1d6 + buffer.readu32(Offsets, Round * 4)
|
||||
|
||||
H5, H4, H3, H2, H1 = H4, H3, bit32.lrotate(H2, 30), H1, Temp
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue