void ExpandKey(const unsigned char* masterKey, unsigned char* keys) { unsigned char C[16] = {0}; unsigned char temp1[16] = {0}; unsigned char temp2[16] = {0}; unsigned char j, i; memcpy(keys, masterKey, 16); memcpy(keys + 16, masterKey + 16, 16); for(j = 0; j < 4; ++j) { memcpy(temp1, keys + j * 2 * 16, 16); memcpy(temp2, keys + (j * 2 + 1) * 16, 16); for( i = 1; i < 8; ++i ) { funcC(j*8+i, C); funcF(temp1, temp2, C, temp1, temp2); } funcC(j*8+8, C); funcF(temp1, temp2, C, temp1, temp2); memcpy(keys + (j * 2 + 2) * 16, temp1, 16); memcpy(keys + (j * 2 + 3) * 16, temp2, 16); } }
float funcB(float input) { float b=0; funcC(input); count++; b++; return input; }
_Bool main() { //Declare variables int num; printf("The game is afoot.\n"); printf("The little dog laughed, to see such sport\n"); printf("And the dish ran away with the spoon\n"); printf("Enter 1, 2, or 3, anything else will end program\n"); scanf("%d", &num); if (num == 1) { return funcA(); } else if (num == 2) { return funcB(); } else if (num == 3) { return funcC(); } else { printf("The game is no longer afoot.\n"); } }
int main(void) { /* A function wrapper to a member variable of a class */ CAnyData<int> dataA{2016}; std::function<int(CAnyData<int>&)> funcA = &CAnyData<int>::m_value; std::cout << funcA(dataA) << std::endl; /* A function wrappter to member function without parameter passing */ CAnyData<float> dataB{2016.1}; std::function<void(CAnyData<float>&)> funcB = &CAnyData<float>::print; funcB(dataB); /* A function wrappter to member function with passing a parameter */ std::function<void(CAnyData<float>&, float)> funcC = &CAnyData<float>::printAfterAdd; funcC(dataB, 0.1); /* A function wrappter to member function generated by std::bind */ std::function<void(float)> funcD = std::bind(&CAnyData<float>::printAfterAdd, &dataB, std::placeholders::_1); funcD(0.2); return 0; }
void funcB() { funcC(); }