Created
May 23, 2022 18:01
-
-
Save lgolubyev/b6b5556c7b19d29fa03bea86724766ac 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
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