Coverage Report

Created: 2025-07-12 06:25

/src/rauc/subprojects/glib-2.76.5/glib/gutilsprivate.h
Line
Count
Source
1
/*
2
 * Copyright © 2018 Endless Mobile, Inc.
3
 *
4
 * SPDX-License-Identifier: LGPL-2.1-or-later
5
 *
6
 * This library is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU Lesser General Public
8
 * License as published by the Free Software Foundation; either
9
 * version 2.1 of the License, or (at your option) any later version.
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
 * Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public
17
 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
18
 *
19
 * Author: Philip Withnall <withnall@endlessm.com>
20
 */
21
22
#ifndef __G_UTILS_PRIVATE_H__
23
#define __G_UTILS_PRIVATE_H__
24
25
#include "glibconfig.h"
26
#include "gtypes.h"
27
#include "gtestutils.h"
28
29
G_BEGIN_DECLS
30
31
void g_set_user_dirs (const gchar *first_dir_type,
32
                      ...) G_GNUC_NULL_TERMINATED;
33
34
/* Returns the smallest power of 2 greater than or equal to n,
35
 * or 0 if such power does not fit in a gsize
36
 */
37
static inline gsize
38
g_nearest_pow (gsize num)
39
51.3k
{
40
51.3k
  gsize n = num - 1;
41
42
51.3k
  g_assert (num > 0 && num <= G_MAXSIZE / 2);
43
44
51.3k
  n |= n >> 1;
45
51.3k
  n |= n >> 2;
46
51.3k
  n |= n >> 4;
47
51.3k
  n |= n >> 8;
48
51.3k
  n |= n >> 16;
49
51.3k
#if GLIB_SIZEOF_SIZE_T == 8
50
51.3k
  n |= n >> 32;
51
51.3k
#endif
52
53
51.3k
  return n + 1;
54
51.3k
}
garray.c:g_nearest_pow
Line
Count
Source
39
35.1k
{
40
35.1k
  gsize n = num - 1;
41
42
35.1k
  g_assert (num > 0 && num <= G_MAXSIZE / 2);
43
44
35.1k
  n |= n >> 1;
45
35.1k
  n |= n >> 2;
46
35.1k
  n |= n >> 4;
47
35.1k
  n |= n >> 8;
48
35.1k
  n |= n >> 16;
49
35.1k
#if GLIB_SIZEOF_SIZE_T == 8
50
35.1k
  n |= n >> 32;
51
35.1k
#endif
52
53
35.1k
  return n + 1;
54
35.1k
}
gstring.c:g_nearest_pow
Line
Count
Source
39
16.2k
{
40
16.2k
  gsize n = num - 1;
41
42
16.2k
  g_assert (num > 0 && num <= G_MAXSIZE / 2);
43
44
16.2k
  n |= n >> 1;
45
16.2k
  n |= n >> 2;
46
16.2k
  n |= n >> 4;
47
16.2k
  n |= n >> 8;
48
16.2k
  n |= n >> 16;
49
16.2k
#if GLIB_SIZEOF_SIZE_T == 8
50
16.2k
  n |= n >> 32;
51
16.2k
#endif
52
53
16.2k
  return n + 1;
54
16.2k
}
Unexecuted instantiation: gtestutils.c:g_nearest_pow
Unexecuted instantiation: gutils.c:g_nearest_pow
Unexecuted instantiation: gdesktopappinfo.c:g_nearest_pow
Unexecuted instantiation: gdbusmessage.c:g_nearest_pow
Unexecuted instantiation: gmemoryoutputstream.c:g_nearest_pow
55
56
void _g_unset_cached_tmp_dir (void);
57
58
G_END_DECLS
59
60
#endif /* __G_UTILS_PRIVATE_H__ */