1
0
mirror of https://github.com/fadden/6502bench.git synced 2025-07-25 14:24:13 +00:00

Exercise address-to-offset function in plugin

Also exercise various formatting options.

Also, fix a bug where the code that applies project/platform symbols
to numeric references was ignoring inline data items.
This commit is contained in:
Andy McFadden
2019-10-07 14:21:26 -07:00
parent 245e0bd9f3
commit dc8e49e4d8
12 changed files with 293 additions and 30 deletions

View File

@@ -39,7 +39,19 @@ namespace PluginCommon {
}
/// <summary>
/// Compute a standard CRC-32 (polynomial 0xedb88320) on a buffer of data.
/// Determines whether the provided offset and length are valid for the array.
/// </summary>
/// <param name="data">Data array that to check against.</param>
/// <param name="startOff">Start offset.</param>
/// <param name="len">Number of bytes.</param>
/// <returns>True if the specified range falls within the array bounds.</returns>
public static bool IsInBounds(byte[] data, int startOff, int len) {
return !(startOff < 0 || len < 0 || startOff >= data.Length || len > data.Length ||
startOff + len > data.Length);
}
/// <summary>
/// Computes a standard CRC-32 (polynomial 0xedb88320) on a buffer of data.
/// </summary>
/// <param name="data">Buffer to process.</param>
/// <returns>CRC value.</returns>