Creates a reusable function macro for performing a prefix sum. Eventually, we'll need this for polyline decomposition  Reasonably fast with max (1024) input elements.