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
private static int SumOdd_BranchFree_Parallel(int[] array) | |
{ | |
int counterA = 0; | |
int counterB = 0; | |
for (int i = 0; i < array.Length; i += 2) | |
{ | |
var elementA = array[i]; | |
var elementB = array[i + 1]; | |
var oddA = elementA & 1; | |
var oddB = elementB & 1; | |
counter += (oddA * elementA); | |
counter += (oddB * elementB); | |
} | |
return counterA + counterB; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment