AD9851 & 9850

Goodmorninig everybody!
I’m trying to program my Arduino for control the AD9851 ic, a famous DDS.
I observe that the programs used don’t work if I put this inside

// transfers a byte, a bit at a time, LSB first to the 9851 via serial DATA line
void tfr_byte(byte data){
  for (int i=0; i<40; i++, data>>=1) {
    digitalWrite(DATA, data & 0x01);      //la "&" qui fa un'operazione booleana con il valore di "data"
    pulseHigh(W_CLK);   //after each bit sent, CLK is pulsed high
  }
}


// frequency calc from datasheet page 8 = <sys clock> * <frequency tuning word>/2^32
void sendFrequency(double frequency) {  
  int32_t freq = frequency * 4294967295/180000000;     
  tfr_byte(freq);
  pulseHigh(FQ_UD);  // Done!  Should see output
}

instead of this

// transfers a byte, a bit at a time, LSB first to the 9850 via serial DATA line
void tfr_byte(byte data){
  for (int i=0; i<8; i++, data>>=1) {
    digitalWrite(DATA, data & 0x01);
    pulseHigh(W_CLK);   //after each bit sent, CLK is pulsed high
  }
}

// frequency calc from datasheet page 8 = <sys clock> * <frequency tuning word>/2^32
void sendFrequency(double frequency) {  
  int32_t freq = frequency * 4294967295/180000000;  // note 125 MHz clock on 9850.  You can make 'slight' tuning variations here by adjusting the clock frequency.
  for (int b=0; b<4; b++, freq>>=8) {
    tfr_byte(freq & 0xFF);
  }
  tfr_byte(0x000);   // Final control byte, all 0 for 9850 chip
  pulseHigh(FQ_UD);  // Done!  Should see output
}

What’s the reason why?
Thank you for the attention

 for (int i=0; i<40; i++, data>>=1) {
    digitalWrite(DATA, data & 0x01);

data is a uint64_t?

Freq is always int32_t

mentorade: Freq is always int32_t

So? That's eight bits short.

Sorry I don t understand what you mean

You're trying to shift 40 bits. A 32 bit data type is 8 bits short.

I can t believe it! This is the problem! What a stupid I am!
Thank you very much!

So It must convert the variable into a binary form before send it, is it correct? And that s why it need a bigger variable.

...or an array.