Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What does this syntax "success |= MAX35101_Read_2WordValue(TOF_DIFF_AVG_REG, &TOF_DIFF_Results->TOF_DiffData);" mean? in C/C++ language?

I am trying to decode the reference code to access the registers in MAX35101 IC.

The code has this syntax at various lines.

What does this mean?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

bool MAX35101_Update_TOF_AVG_DIFFData(Flow_ResultsStruct* TOF_DIFF_Results)

{

    bool success = false;
        success |= MAX35101_Read_2WordValue(TOF_DIFF_AVG_REG, &TOF_DIFF_Results->TOF_DiffData);  
    return success;
}

Simply what does Z |= X(a, &b->c); mean?

>Solution :

Z |= X(a, &b->c); could be rewritten as Z = Z | X(a, &(b->c));

We have a pointer to a struct Flow_ResultsStruct* b. To access a member of a struct via a pointer we use a ->. So it is get the address of member c of struct b for which we have a pointer.

Pass a and the address to X.

Now logical or (|) the return value with Z which is false (0) so Z equals the return of the function.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading