Modules/AzureDevOpsDsc.Common/Api/Functions/Private/Helper/ACL/Get-BitwiseOrResult.ps1
|
<#
.SYNOPSIS Performs a bitwise OR operation on an array of integers. .DESCRIPTION The Get-BitwiseOrResult function takes an array of integers as input and performs a bitwise OR operation on them. It returns the result of the operation. .PARAMETER integers Specifies the array of integers on which the bitwise OR operation is performed. Required? true Position? 1 Default value Accept pipeline input? false Accept wildcard characters? false .EXAMPLE $inputArray = 1, 2, 4, 8 $result = Get-BitwiseOrResult -integers $inputArray $result # Output: 15 .NOTES Author: Michael Zanatta Date: 2025-01-06 #> Function Get-BitwiseOrResult { [CmdletBinding()] param ( [int[]]$integers ) Write-Verbose "[Get-BitwiseOrResult] Started." Write-Verbose "[Get-BitwiseOrResult] Integers: $integers" # Parameter is typed [int[]], so values are already guaranteed to be integers. $result = 0 foreach ($integer in $integers) { $result = $result -bor $integer } return $result } |