Coercion of bitArray to Array and Integer Arrays to bitArrays

Topic: version 4 MAXScript Language Improvements/Language Improvements

Coercion of bitArray to array and integer arrays to bitArrays implemented.

<bitArray> as array

<integer array> as bitArray

Example:

a=#{1..5,10}

b=a as array

c=b as bitarray

If an element of the array cannot be coerced to an integer, and error is thrown .numberSet and .isEmpty are read-only properties, which have been added to the BitArrayValue class.

.numberSet

Returns the number of bits set

.isEmpty

Returns true if no bits are set and false if one or more bits are set.

Example:

a=#{1..5,10..20}
a.numberset --> 16
a.isEmpty --> false
a=#{}
a.numberset --> 0
a.isEmpty --> true

The '*' operator has been added to bitArrays which performs an 'AND' operation:

<bitarray> * <bitarray> -- intersection ("AND" operation)

See also