When accessing an element in an array the square brackets are used like so:
{'X is an int and Numbers is an int array'}
X := Numbers[8];
However, While reading others' code I sometimes find the following syntax:
{'PBox , SBox1 , SBox2 are arrays of int , And X,Y are ints'}
Result := Result or PBox(.SBox1[X] or SBox2[Y].);
PBox(someNumber)
? Is this another way to access an array element?We can construct a cell array using curly brackets: '{' and '}'. Recall that we normally use the square brackets '[' and ']' to construct an ordinary array (e.g. see Example 5.7). Here, we initialize a cell array to contain three strings with different lengths.
An array is a data structure consisting of a collection of elements (values or variables), each identified by at least one array index or key. Depending on the language, array types may overlap (or be identified with) other data types that describe aggregates of values, such as lists and strings.
An array is a variable that can store multiple values. For example, if you want to store 100 integers, you can create an array for it. int data[100];
In coding and programming, an array is a collection of items, or data, stored in contiguous memory locations, also known as database systems . The purpose of an array is to store multiple pieces of data of the same type together.
Yes, now I see what you do.
In fact, (.
and .)
are merely alternative ways (but very uncommon!) of writing [
and ]
in Delphi.
If PBox
is an array, then PBox[a]
(or, equivalently, PBox(.a.)
) would require a
to be an integer, right? And if SBox1[x]
and SBox2[Y]
are integers, so is the bitwise or
of them. (Bitwise or
is an operation that takes two integers and returns a new integer.) Hence, PBox(.SBox1[X] or SBox2[Y].)
is the (SBox1[X] or SBox2[Y])
th element in the array PBox
, that is, an integer. So it makes sense to compute the bitwise or
between Result
and this integer, which is what is done:
Result := Result or PBox(.SBox1[X] or SBox2[Y].);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With