1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-12-28 01:29:29 +00:00

Fix edge-face validation check

This commit is contained in:
Andy McFadden 2020-03-13 18:39:11 -07:00
parent 662dda106f
commit 8ff1fa7034
2 changed files with 9 additions and 1 deletions

View File

@ -27,6 +27,14 @@ namespace PluginCommon {
/// <remarks>
/// This is currently simple enough that it could just be an interface, but I don't want
/// to rely on that remaining true.
///
/// TODO(maybe): add a "IsAddressRangeValid(int srcOffset, int addr, int length)" method
/// that verifies an entire address range is in memory. This would allow subsequent access
/// to skip error checks. (You still have to do the address-to-offset translation on every
/// byte though, which is where most of the expense is.)
/// TODO(maybe): add a "CopyAddressRange(byte[] data, int srcOffset, int addr, int length)"
/// that returns a newly-allocated buffer with the data copied out. This would allow fast
/// access to data that is split into multiple regions.
/// </remarks>
public class AddressTranslate {
private AddressMap mAddrMap;

View File

@ -192,7 +192,7 @@ namespace PluginCommon {
}
// check edge-faces
foreach (IntPair ip in mVertexFaces) {
foreach (IntPair ip in mEdgeFaces) {
if (ip.Val0 < 0 || ip.Val0 >= edgeCount ||
ip.Val1 < 0 || ip.Val1 >= faceCount) {
msg = "invalid edge-face (e=" + ip.Val0 + ", f=" + ip.Val1 + ")";