c&=~3  in livefx.c , can you repeat slowly ?

Started by fredvs,

fredvs

Hello Folks

 In the livefx example in C++ :


/ stream function - play the recording data
DWORD CALLBACK stream(HSTREAM handle, char *buffer, int length, DWORD user)
{
      int c;
      // check how much recorded data is buffered
      c=BASS_ChannelGetData(RECORDCHAN,0,BASS_DATA_AVAILABLE);
      c-=length;
      if (c>2*chunk+1764) { // buffer has gotten pretty large so remove some
            c-=chunk; // leave a single 'chunk'
            c&=~3;      // align to sample boundary
            BASS_ChannelGetData(RECORDCHAN,0,c); // remove it
      }
      // fetch recorded data into stream
      c=BASS_ChannelGetData(RECORDCHAN,buffer,length);
      if (c<length) memset(buffer+c,0,length-c); // short of data
      return length;
}


I work with Delphi, i can understand nearly all,
but who can explain me the transcription in Pascal of :

 
c&=~3;
:o

(: JOBnik! :)

Hi ;D

I'm not a Delphi programmer, but it should be like in VB (I hope) :)

c = c - (c mod 4);

Have fun!

8) JOBnik! 8)

Jcl

~ is the bitwise negation (or one's complement) operator in C (means, it does "1 - bit" for every bit, thus: all bits are flipped).

Some Pascal compilers have the built-in BNOT function, so that'd be equivalent to:

 c:=c and bnot(3);

if delphi doesn't (which i do not know), then you should make a function which just flips all bits on a integer :-)