--- layout: stdlib-reference --- # msad4 ## Description Masked sum of absolute differences of byte alignments. This function computes the absolute differences of the byte alignments of the reference and source values, and adds them to the accumulated differences. ## Signature
vector<uint, 4> msad4(
    uint reference,
    vector<uint, 2> source,
    vector<uint, 4> accum);

## Parameters #### reference : uint The reference 4 bytes packed in a uint. #### source : [vector](../types/vector/index.html)\ The source 2 uints packed in a uint2. #### accum : [vector](../types/vector/index.html)\ The accumulated differences. ## Return value The updated accumulated differences. ## Remarks In HLSL, this is implemented with the msad4 intrinsic. ## Availability and Requirements Defined for the following targets: #### hlsl Available in all stages. #### glsl Available in all stages. #### cpp Available in all stages. #### cuda Available in all stages. #### spirv Available in all stages.