| Nico Huber | a5c8ba2 | 2017-02-09 16:35:33 +0100 | [diff] [blame^] | 1 | -- |
| 2 | -- Copyright (C) 2017 secunet Security Networks AG |
| 3 | -- |
| 4 | -- This program is free software; you can redistribute it and/or modify |
| 5 | -- it under the terms of the GNU General Public License as published by |
| 6 | -- the Free Software Foundation; either version 2 of the License, or |
| 7 | -- (at your option) any later version. |
| 8 | -- |
| 9 | -- This program is distributed in the hope that it will be useful, |
| 10 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | -- GNU General Public License for more details. |
| 13 | -- |
| 14 | |
| 15 | package body HW is |
| 16 | |
| 17 | function Div_Round_Closest (N, M : Pos8) return Int8 is |
| 18 | begin |
| 19 | return (N + M / 2) / M; |
| 20 | end Div_Round_Closest; |
| 21 | |
| 22 | function Div_Round_Closest (N, M : Pos16) return Int16 is |
| 23 | begin |
| 24 | return (N + M / 2) / M; |
| 25 | end Div_Round_Closest; |
| 26 | |
| 27 | function Div_Round_Closest (N, M : Pos32) return Int32 is |
| 28 | begin |
| 29 | return (N + M / 2) / M; |
| 30 | end Div_Round_Closest; |
| 31 | |
| 32 | function Div_Round_Closest (N, M : Pos64) return Int64 is |
| 33 | begin |
| 34 | return (N + M / 2) / M; |
| 35 | end Div_Round_Closest; |
| 36 | |
| 37 | end HW; |