Author Topic: [PJSR] [Critical] Incorrect results of ByteArray and Vector search routines  (Read 3449 times)

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 7111
    • http://pixinsight.com/
The following routines:

Number ByteArray.linearSearch( uint8 value[, uint startIndex[, uint endIndex]] )
Number ByteArray.binarySearch( uint8 value[, uint startIndex[, uint endIndex]] )

int Vector.linearSearch( Number value[, int startIndex[, int endIndex]] )
int Vector.binarySearch( Number value[, int startIndex[, int endIndex]] )


return incorrect element indexes when the search operations succeed. When the specified value is found, each routine should return the zero-based index of the corresponding array or vector element, but the returned index is counted from the startIndex argument. When the value is not found, all routines correctly return -1.

Workaround: subtract startIndex from the returned value to get a zero-based array or vector element index.

This bug has already been fixed in version 1.6.1.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/