Why do we need 'bitwise or' ?

Yun Wang
  • 17 Aug '20

Hi, Dylan

I downloaded the illustris_python package from Github. And when I read the scripts, I found that
there is one operation "bitwise or" in the function 'getNumPat' of the module 'snapshot'. As shown
below, the code snippet is

for j in range(nTypes):
nPart[j] = header['NumPart_Total'][j] | (header['NumPart_Total_HighWord'][j] << 32)

I don't understand why we need bitwise or operation here.

Dylan Nelson
  • 18 Aug '20

Hi Yun,

This is a relic of past history, when we could only store 32 bit integers.

You can read about in the Gadget2 users manual - check page 33, the structure of io_header, and NallHW.

  • Page 1 of 1