MemoryBlock methods

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

Back to MemoryBlock class.

MemoryBlock.BitwiseXOrMBS(Second as MemoryBlock, Dest as MemoryBlock = nil) as MemoryBlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MemoryBlock MBS Util Plugin 22.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Bitwise XOR for a Memoryblock.
Example

Dim m1 As New MemoryBlock(555)
Dim m2 As New MemoryBlock(555)
Dim r As New Random

For i As Integer = 0 To 555-1
m1.Byte(i) = r.InRange(0,255)
m2.Byte(i) = r.InRange(0,255)
Next

Dim mAND As MemoryBlock = m1.BitwiseAndMBS(m2)
Dim mOR As MemoryBlock = m1.BitwiseOrMBS(m2)
Dim mXOR As MemoryBlock = m1.BitwiseXOrMBS(m2)


// check value
For i As Integer = 0 To 555-1
If BitwiseAnd(m1.Byte(i), m2.Byte(i)) <> mAND.Byte(i) Then
Break
End If
If BitwiseOr(m1.Byte(i), m2.Byte(i)) <> mOR.Byte(i) Then
Break
End If
If BitwiseXor(m1.Byte(i), m2.Byte(i)) <> mXOR.Byte(i) Then
Break
End If

Next

Break

We walk over all values in current and second MemoryBlock and apply a bitwise XOR to each byte and store that in the destination block.

If dest is nil, a new memoryblock is created. You can speed up processing with reusing the same memoryblock in iterations. If you pass a memoryblock, the plugin does not check the size of the memoryblock.

Returns nil on any error. For example if source is a memoryblock without a known size.

Blog Entries

The items on this page are in the following plugins: MBS Util Plugin.


💬 Ask a question or report a problem