MCPcopy Create free account
hub / github.com/DanielOgorchock/ST_Anything / dec2binWcharfill

Method dec2binWcharfill

Arduino/libraries/RCSwitch/RCSwitch.cpp:801–820  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

799}
800
801char* RCSwitch::dec2binWcharfill(unsigned long Dec, unsigned int bitLength, char fill){
802 static char bin[64];
803 unsigned int i=0;
804
805 while (Dec > 0) {
806 bin[32+i++] = ((Dec & 1) > 0) ? '1' : fill;
807 Dec = Dec >> 1;
808 }
809
810 for (unsigned int j = 0; j< bitLength; j++) {
811 if (j >= bitLength - i) {
812 bin[j] = bin[ 31 + i - (j - (bitLength - i)) ];
813 }else {
814 bin[j] = fill;
815 }
816 }
817 bin[bitLength] = '\0';
818
819 return bin;
820}
821
822
823

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected