blob: ae9f3ae1142a2e330df4c4cd5c68e06441ff1f7d [file] [log] [blame]
The Android Open Source Project30957f52008-10-21 07:00:00 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/* ---- includes ----------------------------------------------------------- */
18
19#include "b_TensorEm/Functions.h"
20#include "b_BasicEm/Math.h"
21
22/* ---- related objects --------------------------------------------------- */
23
24/* ---- typedefs ----------------------------------------------------------- */
25
26/* ---- constants ---------------------------------------------------------- */
27
28/* ------------------------------------------------------------------------- */
29
30/* ========================================================================= */
31/* */
32/* ---- \ghd{ external functions } ----------------------------------------- */
33/* */
34/* ========================================================================= */
35
36/* ------------------------------------------------------------------------- */
37
38uint32 bts_absIntLog2( int32 vA )
39{
40 return bbs_intLog2( bbs_abs( vA ) );
41}
42
43/* ------------------------------------------------------------------------- */
44
45uint32 bts_maxAbsIntLog2Of2( int32 v1A, int32 v2A )
46{
47 uint32 maxL = bbs_max( ( uint32 )bbs_abs( v1A ), ( uint32 )bbs_abs( v2A ) );
48 return bbs_intLog2( maxL );
49}
50
51/* ------------------------------------------------------------------------- */
52
53uint32 bts_maxAbsIntLog2Of3( int32 v1A, int32 v2A, int32 v3A )
54{
55 uint32 maxL = bbs_abs( v1A );
56 maxL = bbs_max( maxL, ( uint32 )bbs_abs( v2A ) );
57 maxL = bbs_max( maxL, ( uint32 )bbs_abs( v3A ) );
58 return bbs_intLog2( maxL );
59}
60
61/* ------------------------------------------------------------------------- */
62
63uint32 bts_maxAbsIntLog2Of4( int32 v1A, int32 v2A, int32 v3A, int32 v4A )
64{
65 uint32 maxL = bbs_abs( v1A );
66 maxL = bbs_max( maxL, ( uint32 )bbs_abs( v2A ) );
67 maxL = bbs_max( maxL, ( uint32 )bbs_abs( v3A ) );
68 maxL = bbs_max( maxL, ( uint32 )bbs_abs( v4A ) );
69 return bbs_intLog2( maxL );
70}
71
72/* ------------------------------------------------------------------------- */