Exemplo n.º 1
0
void KeyManager::SetCurrentKeySequence(uint32_t aKeySequence)
{
    mPreviousKeyValid = true;
    mPreviousKeySequence = mCurrentKeySequence;
    memcpy(mPreviousKey, mCurrentKey, sizeof(mPreviousKey));

    mCurrentKeySequence = aKeySequence;
    ComputeKey(mCurrentKeySequence, mCurrentKey);

    mMacFrameCounter = 0;
    mMleFrameCounter = 0;

    UpdateNeighbors();
}
Exemplo n.º 2
0
void Simulate(int g,int rank,int N, int effective_cols_size,int matrix[N][effective_cols_size],int p)
{
    int tmpdata[N][effective_cols_size];
    int i,j;
    for (i = 0; i < N; i++)
        for (j = 0; j < effective_cols_size; j++)
            tmpdata[i][j] = matrix[i][j];

        for (i = 0; i < N; i++) {
            for (j = 1; j < effective_cols_size - 1; j++) {
                int state;
                state = DetermineState(i, j, rank, N, effective_cols_size,
                        tmpdata);
                if ((state < 2) || (state > 3))
                    matrix[i][j] = 0;
                else
                    matrix[i][j] = 1;

            }
        }

    UpdateNeighbors(rank,p,N,effective_cols_size,matrix);

//    printf("\n Last State : of rank %d\n",rank);
//        for (i = 0; i < N; i++) {
//            for (j = 0; j < effective_cols_size; j++)
//                printf("v%d-%d-%d = %d  ",rank,i,j, tmpdata[i][j]);
//            printf("\n");
//        }

//    //printf("\n \n New State : of rank %d\n",rank);
//                for (i = 0; i < N; i++) {
//                    for (j = 0; j < effective_cols_size; j++)
//                        //printf("v%d-%d-%d = %d  ",rank,i,j, matrix[i][j]);
//                    //printf("\n");
//                }

//    UpdateNeighbors(rank,p,N,effective_cols_size,matrix);

}