Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/12/18 08:17:28 (5 years ago)
Author:
gkronber
Message:

#1973: merged r15766 from trunk to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • stable/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Compiler/SymbolicExpressionTreeLinearCompiler.cs

    r15584 r15836  
    2727      var root = tree.Root.GetSubtree(0).GetSubtree(0);
    2828      var code = new LinearInstruction[root.GetLength()];
    29       code[0] = new LinearInstruction { dynamicNode = root, nArguments = (byte)root.SubtreeCount, opCode = opCodeMapper(root) };
     29      if (root.SubtreeCount > ushort.MaxValue) throw new ArgumentException("Number of subtrees is too big (>65.535)");
     30      code[0] = new LinearInstruction { dynamicNode = root, nArguments = (ushort)root.SubtreeCount, opCode = opCodeMapper(root) };
    3031      int c = 1, i = 0;
    3132      foreach (var node in root.IterateNodesBreadth()) {
    3233        for (int j = 0; j < node.SubtreeCount; ++j) {
    3334          var s = node.GetSubtree(j);
    34           code[c + j] = new LinearInstruction { dynamicNode = s, nArguments = (byte)s.SubtreeCount, opCode = opCodeMapper(s) };
     35          if (s.SubtreeCount > ushort.MaxValue) throw new ArgumentException("Number of subtrees is too big (>65.535)");
     36          code[c + j] = new LinearInstruction { dynamicNode = s, nArguments = (ushort)s.SubtreeCount, opCode = opCodeMapper(s) };
    3537        }
    3638        code[i].childIndex = c;
Note: See TracChangeset for help on using the changeset viewer.