| 1 |
------------------------------------------------------------------------------ |
| 2 |
-- -- |
| 3 |
-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- |
| 4 |
-- -- |
| 5 |
-- S Y S T E M . G E N E R I C _ V E C T O R _ O P E R A T I O N S -- |
| 6 |
-- -- |
| 7 |
-- S p e c -- |
| 8 |
-- -- |
| 9 |
-- Copyright (C) 2002-2025, Free Software Foundation, Inc. -- |
| 10 |
-- -- |
| 11 |
-- GNAT is free software; you can redistribute it and/or modify it under -- |
| 12 |
-- terms of the GNU General Public License as published by the Free Soft- -- |
| 13 |
-- ware Foundation; either version 3, or (at your option) any later ver- -- |
| 14 |
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
| 15 |
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- |
| 16 |
-- or FITNESS FOR A PARTICULAR PURPOSE. -- |
| 17 |
-- -- |
| 18 |
-- As a special exception under Section 7 of GPL version 3, you are granted -- |
| 19 |
-- additional permissions described in the GCC Runtime Library Exception, -- |
| 20 |
-- version 3.1, as published by the Free Software Foundation. -- |
| 21 |
-- -- |
| 22 |
-- You should have received a copy of the GNU General Public License and -- |
| 23 |
-- a copy of the GCC Runtime Library Exception along with this program; -- |
| 24 |
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- |
| 25 |
-- <http://www.gnu.org/licenses/>. -- |
| 26 |
-- -- |
| 27 |
-- GNAT was originally developed by the GNAT team at New York University. -- |
| 28 |
-- Extensive contributions were provided by Ada Core Technologies Inc. -- |
| 29 |
-- -- |
| 30 |
------------------------------------------------------------------------------ |
| 31 |
|
| 32 |
-- This package contains generic procedures for vector operations on arrays. |
| 33 |
-- If the arguments are aligned on word boundaries and the word size is a |
| 34 |
-- multiple M of the element size, the operations will be done M elements |
| 35 |
-- at a time using vector operations on a word. |
| 36 |
-- |
| 37 |
-- All routines assume argument arrays have the same length, and arguments |
| 38 |
-- with mode "in" do not alias arguments with mode "out" or "in out". |
| 39 |
-- If the number N of elements to be processed is not a multiple of M |
| 40 |
-- the final N rem M elements will be processed one item at a time. |
| 41 |
|
| 42 |
with System.Vectors; |
| 43 |
with System.Storage_Elements; |
| 44 |
|
| 45 |
generic |
| 46 |
type Element is (<>); |
| 47 |
type Index is (<>); |
| 48 |
type Element_Array is array (Index range <>) of Element; |
| 49 |
|
| 50 |
package System.Generic_Vector_Operations is |
| 51 |
pragma Pure; |
| 52 |
|
| 53 |
generic |
| 54 |
with function Element_Op (X, Y : Element) return Element; |
| 55 |
with function Vector_Op (X, Y : Vectors.Vector) return Vectors.Vector; |
| 56 |
procedure Binary_Operation |
| 57 |
(R, X, Y : System.Address; |
| 58 |
Length : System.Storage_Elements.Storage_Count); |
| 59 |
-- *Binary_Operation* iterates on the elements pointed to by `X` and `Y` |
| 60 |
-- and places the result in `R`. |
| 61 |
|
| 62 |
generic |
| 63 |
with function Element_Op (X : Element) return Element; |
| 64 |
with function Vector_Op (X : Vectors.Vector) return Vectors.Vector; |
| 65 |
procedure Unary_Operation |
| 66 |
(R, X : System.Address; |
| 67 |
Length : System.Storage_Elements.Storage_Count); |
| 68 |
-- *Unary_Operation* iterates on the elements pointed to by `X` |
| 69 |
-- and places the result in `R`. |
| 70 |
|
| 71 |
end System.Generic_Vector_Operations; |