-
-
Save sehe/381964b020ae0ebc28a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
byte daybits = 0; | |
if (schedule.isSunday()) daybits |= 0x01; | |
if (schedule.isMonday()) daybits |= 0x02; | |
if (schedule.isTuesday()) daybits |= 0x04; | |
if (schedule.isWednesday()) daybits |= 0x08; | |
if (schedule.isThursday()) daybits |= 0x10; | |
if (schedule.isFriday()) daybits |= 0x20; | |
if (schedule.isSaturday()) daybits |= 0x40; | |
daybits = (byte) (~daybits & 0x7f); // invert, clearing high bit | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment