Platforms to show: All Mac Windows Linux Cross-Platform

Back to MemoryBlock class.

MemoryBlock.MinMBS(firstMem as Ptr, secondMem as Ptr, BitSize as Integer = 8, Signed as Boolean = false, offsetByte as Integer = 0, lengthBytes as Integer = 0) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method MemoryBlock MBS Util Plugin 14.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Calculates min values of values in memory.
Example
dim m1 as new MemoryBlock(24)
dim m2 as new MemoryBlock(24)
dim mr1 as new MemoryBlock(24)
dim mr2 as new MemoryBlock(24)

for i as Integer = 0 to 11
m1.UInt16Value(2*i) = i
m2.UInt16Value(2*(11-i)) = i
next

if mr1.minMBS(m1, m2, 16, false, 0, 24) then
if mr2.maxMBS(m1, m2, 16, false, 0, 24) then

MsgBox EncodeHex(m1)+" first"+EndOfLine+_
EncodeHex(m2)+" second"+EndOfLine+_
EncodeHex(mr1)+" min"+EndOfLine+_
EncodeHex(mr2)+" max"

end if
end if

firstMem and secondMem can be ptr or memoryblock with some values. Can be same as destination (the memoryblock the method is called at)
BitSize defines integer bit depth 8, 16, 32 or 64. Signed defines if to expect signed or unsigned integers.
offsetByte defines offset in destination memoryblock. lengthBytes is length of memory. If zero, we use size of destination memoryblock.
Passing bad parameters can easily lead to crash. Return true on success and false on failure and raises exceptions for invalid parameters.

Some examples using this method:

Blog Entries

Xojo Developer Magazine

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


The biggest plugin in space...