Changeset 10113


Ignore:
Timestamp:
10/15/05 17:04:44 (16 years ago)
Author:
piso
Message:

getRowMajorIndex(int[] subscripts)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/org/armedbear/lisp/AbstractArray.java

    r10112 r10113  
    33 *
    44 * Copyright (C) 2003-2005 Peter Graves
    5  * $Id: AbstractArray.java,v 1.42 2005-10-15 16:45:40 piso Exp $
     5 * $Id: AbstractArray.java,v 1.43 2005-10-15 17:04:44 piso Exp $
    66 *
    77 * This program is free software; you can redistribute it and/or
     
    126126        final int rank = getRank();
    127127        if (rank != subscripts.length) {
    128             StringBuffer sb = new StringBuffer("Wrong number of subscripts (");
     128            FastStringBuffer sb =
     129                new FastStringBuffer("Wrong number of subscripts (");
    129130            sb.append(subscripts.length);
    130131            sb.append(") for array of rank ");
     
    136137        int size = 1;
    137138        for (int i = rank; i-- > 0;) {
    138             int dim = getDimension(i);
    139             int lastSize = size;
     139            final int dim = getDimension(i);
     140            final int lastSize = size;
    140141            size *= dim;
    141             int n = subscripts[i];
    142             if (n < 0 || n >= getDimension(i)) {
    143                 StringBuffer sb = new StringBuffer("Invalid index ");
     142            final int n = subscripts[i];
     143            if (n < 0 || n >= dim) {
     144                FastStringBuffer sb = new FastStringBuffer("Invalid index ");
    144145                sb.append(n);
    145146                sb.append(" for array ");
Note: See TracChangeset for help on using the changeset viewer.