Skip to content

Interpolated var access is sometimes -1 #15

@marchc1

Description

@marchc1

In InterpolatedVar.cs, changed by 1348c82:

private int WrapRange(int i) {
	return MathLib.Modulo(i, maxElement); // TODO: Why does -1 get passed here sometimes. We shouldn't have to change this to accomodate.
}

This should actually be

return (i >= maxElement) ? (i - maxElement) : i;

But for some reason, i coming in can sometimes be -1 when coming from here:

	public ref T this[int i] {
		get {
			Assert(IsIdxValid(i));
			i += firstElement;
			i = WrapRange(i);
			return ref elements![i];
		}
	}

There is a check for this (IsIdxValid), but it's just an assert. This must be some bug in my implementation I would imagine, but further research is needed. For now, the modulo works with an occasional hiccup.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't workingHelp WantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions