/************************************************************************
*
* Purpose: Display a byte in binary format.
*
* Author: M.J. Leslie.
*
* Date: 19-Mar-95
*
* Improvements:
* 1) Return the result to the calling function.
* 2) Make it work on integers (4 bytes long).
*
************************************************************************/
void binary_op(char byte); /* Print a byte in binary. */
/************************************************************************/
main()
{
char byte=55;
binary_op(byte); /* Print a byte in binary. */
}
/************************************************************************/
void binary_op(char byte)
{
int count=8; /* Number of bits in a byte. */
while(count--)
{
/* AND the high order bit (the
* left one) If the bit is set,
* print a ONE. */
printf("%d", ( byte & 128 ) ? 1 : 0 );
/* Move all the bits LEFT. */
byte <<= 1;
}
printf("\n");
}
/************************************************************************
*
* Program results.
* ----------------
*
* 00110111
*
************************************************************************/
ivate-remove
Merge tag 'iio-fixes-for-4.10b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes:
Second set of IIO fixes for the 4.10 cycle.
* afe4403
- retrieve valid iio_dev in suspend / resume. Previously using the wrong
dev for a call to dev_to_iio_dev.
* afe4404
- retrieve valid iio_dev in suspend / resume. Previously using the wrong
dev for a call to dev_to_iio_dev.
* dht11
- Something seems to have caused a regression in timing on the raspberry pi
2B. However, the bug that it threw up was real. msleep was occasionally
resulting in very long sleeps, over the limit possible to read from this
chip. Switch to usleep_range to avoid this. The timing needed by this
part is very fiddly.
* max30100
- wrong parenthesis around fifo count check meant it always read after the
almost_full state had been reached. I've tagged this with a fixes tag which
covers the last patch that it will not need precursor patches. The bug
predates that but will need backporting.
* palmas_gpadc.
- retrieve valid iio_dev in suspend / resume. Previously using the wrong
dev for a call to dev_to_iio_dev.