@img/sharp-libvips-dev-wasm32 1.2.0 → 1.2.2-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/include/ffi.h +3 -3
- package/include/ffitarget.h +17 -0
- package/include/glib-2.0/gio/gdbuserror.h +9 -8
- package/include/glib-2.0/gio/ginetaddress.h +12 -0
- package/include/glib-2.0/gio/gioenums.h +9 -2
- package/include/glib-2.0/glib/gstring.h +2 -2
- package/include/glib-2.0/gobject/gvalue.h +78 -35
- package/include/hwy/abort.h +2 -19
- package/include/hwy/aligned_allocator.h +11 -7
- package/include/hwy/auto_tune.h +504 -0
- package/include/hwy/base.h +425 -104
- package/include/hwy/cache_control.h +16 -0
- package/include/hwy/detect_compiler_arch.h +32 -1
- package/include/hwy/detect_targets.h +251 -67
- package/include/hwy/foreach_target.h +35 -0
- package/include/hwy/highway.h +185 -76
- package/include/hwy/nanobenchmark.h +1 -19
- package/include/hwy/ops/arm_neon-inl.h +969 -458
- package/include/hwy/ops/arm_sve-inl.h +1137 -359
- package/include/hwy/ops/emu128-inl.h +97 -11
- package/include/hwy/ops/generic_ops-inl.h +1222 -34
- package/include/hwy/ops/loongarch_lasx-inl.h +4664 -0
- package/include/hwy/ops/loongarch_lsx-inl.h +5933 -0
- package/include/hwy/ops/ppc_vsx-inl.h +306 -126
- package/include/hwy/ops/rvv-inl.h +546 -51
- package/include/hwy/ops/scalar-inl.h +77 -22
- package/include/hwy/ops/set_macros-inl.h +133 -17
- package/include/hwy/ops/shared-inl.h +50 -10
- package/include/hwy/ops/wasm_128-inl.h +137 -92
- package/include/hwy/ops/x86_128-inl.h +773 -214
- package/include/hwy/ops/x86_256-inl.h +712 -255
- package/include/hwy/ops/x86_512-inl.h +429 -753
- package/include/hwy/ops/x86_avx3-inl.h +501 -0
- package/include/hwy/per_target.h +2 -1
- package/include/hwy/profiler.h +622 -486
- package/include/hwy/targets.h +62 -20
- package/include/hwy/timer-inl.h +8 -160
- package/include/hwy/timer.h +170 -3
- package/include/hwy/x86_cpuid.h +81 -0
- package/include/libheif/heif_cxx.h +25 -5
- package/include/libheif/heif_regions.h +5 -5
- package/include/libheif/heif_version.h +2 -2
- package/include/webp/decode.h +11 -2
- package/include/webp/demux.h +2 -0
- package/include/webp/encode.h +2 -0
- package/include/webp/mux_types.h +1 -0
- package/include/webp/sharpyuv/sharpyuv.h +1 -1
- package/include/webp/types.h +2 -2
- package/include/zlib.h +3 -3
- package/lib/glib-2.0/include/glibconfig.h +1 -1
- package/lib/libaom.a +0 -0
- package/lib/libcgif.a +0 -0
- package/lib/libexif.a +0 -0
- package/lib/libexpat.a +0 -0
- package/lib/libffi.a +0 -0
- package/lib/libgio-2.0.a +0 -0
- package/lib/libglib-2.0.a +0 -0
- package/lib/libgmodule-2.0.a +0 -0
- package/lib/libgobject-2.0.a +0 -0
- package/lib/libgthread-2.0.a +0 -0
- package/lib/libheif.a +0 -0
- package/lib/libhwy.a +0 -0
- package/lib/libimagequant.a +0 -0
- package/lib/libjpeg.a +0 -0
- package/lib/liblcms2.a +0 -0
- package/lib/libresvg.a +0 -0
- package/lib/libsharpyuv.a +0 -0
- package/lib/libsharpyuv.la +2 -2
- package/lib/libspng.a +0 -0
- package/lib/libtiff.a +0 -0
- package/lib/libvips-cpp.a +0 -0
- package/lib/libvips.a +0 -0
- package/lib/libwebp.a +0 -0
- package/lib/libwebp.la +4 -4
- package/lib/libwebpdemux.a +0 -0
- package/lib/libwebpdemux.la +2 -2
- package/lib/libwebpmux.a +0 -0
- package/lib/libwebpmux.la +2 -2
- package/lib/libz.a +0 -0
- package/lib/pkgconfig/gio-2.0.pc +1 -1
- package/lib/pkgconfig/glib-2.0.pc +1 -1
- package/lib/pkgconfig/gmodule-2.0.pc +1 -1
- package/lib/pkgconfig/gmodule-export-2.0.pc +1 -1
- package/lib/pkgconfig/gmodule-no-export-2.0.pc +1 -1
- package/lib/pkgconfig/gobject-2.0.pc +1 -1
- package/lib/pkgconfig/gthread-2.0.pc +1 -1
- package/lib/pkgconfig/libffi.pc +1 -1
- package/lib/pkgconfig/libheif.pc +1 -1
- package/lib/pkgconfig/libhwy.pc +1 -1
- package/lib/pkgconfig/libsharpyuv.pc +1 -1
- package/lib/pkgconfig/libwebp.pc +1 -1
- package/lib/pkgconfig/libwebpdemux.pc +1 -1
- package/lib/pkgconfig/libwebpmux.pc +1 -1
- package/lib/pkgconfig/zlib.pc +1 -0
- package/package.json +1 -1
- package/versions.json +7 -7
package/include/ffi.h
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* -----------------------------------------------------------------*-C-*-
|
|
2
|
-
libffi 3.5.
|
|
2
|
+
libffi 3.5.2
|
|
3
3
|
- Copyright (c) 2011, 2014, 2019, 2021, 2022, 2024, 2025 Anthony Green
|
|
4
4
|
- Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc.
|
|
5
5
|
|
|
@@ -316,8 +316,8 @@ size_t ffi_java_raw_size (ffi_cif *cif) __attribute__((deprecated));
|
|
|
316
316
|
|
|
317
317
|
/* ---- Version API ------------------------------------------------------ */
|
|
318
318
|
|
|
319
|
-
#define FFI_VERSION_STRING "3.5.
|
|
320
|
-
#define FFI_VERSION_NUMBER
|
|
319
|
+
#define FFI_VERSION_STRING "3.5.2"
|
|
320
|
+
#define FFI_VERSION_NUMBER 30502
|
|
321
321
|
|
|
322
322
|
#ifndef LIBFFI_ASM
|
|
323
323
|
/* Return a version string. */
|
package/include/ffitarget.h
CHANGED
|
@@ -42,14 +42,31 @@ typedef void (*ffi_fp)(void);
|
|
|
42
42
|
|
|
43
43
|
typedef enum ffi_abi {
|
|
44
44
|
FFI_FIRST_ABI = 0,
|
|
45
|
+
#if __SIZEOF_POINTER__ == 4
|
|
45
46
|
FFI_WASM32, // "raw", no structures, varargs, or closures (not implemented!)
|
|
46
47
|
FFI_WASM32_EMSCRIPTEN, // structures, varargs, and split 64-bit params
|
|
48
|
+
#elif __SIZEOF_POINTER__ == 8
|
|
49
|
+
FFI_WASM64,
|
|
50
|
+
FFI_WASM64_EMSCRIPTEN,
|
|
51
|
+
#else
|
|
52
|
+
#error "Unknown pointer size"
|
|
53
|
+
#endif
|
|
47
54
|
FFI_LAST_ABI,
|
|
55
|
+
#if __SIZEOF_POINTER__ == 4
|
|
48
56
|
#ifdef __EMSCRIPTEN__
|
|
49
57
|
FFI_DEFAULT_ABI = FFI_WASM32_EMSCRIPTEN
|
|
50
58
|
#else
|
|
51
59
|
FFI_DEFAULT_ABI = FFI_WASM32
|
|
52
60
|
#endif
|
|
61
|
+
#elif __SIZEOF_POINTER__ == 8
|
|
62
|
+
#ifdef __EMSCRIPTEN__
|
|
63
|
+
FFI_DEFAULT_ABI = FFI_WASM64_EMSCRIPTEN
|
|
64
|
+
#else
|
|
65
|
+
FFI_DEFAULT_ABI = FFI_WASM64
|
|
66
|
+
#endif
|
|
67
|
+
#else
|
|
68
|
+
#error "Unknown pointer size"
|
|
69
|
+
#endif
|
|
53
70
|
} ffi_abi;
|
|
54
71
|
|
|
55
72
|
#define FFI_CLOSURES 1
|
|
@@ -34,14 +34,15 @@ G_BEGIN_DECLS
|
|
|
34
34
|
/**
|
|
35
35
|
* G_DBUS_ERROR:
|
|
36
36
|
*
|
|
37
|
-
* Error domain for errors generated by a remote message bus.
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* Error domain for errors generated by a remote message bus.
|
|
38
|
+
*
|
|
39
|
+
* Errors in this domain will be from the [error@Gio.DBusError] enumeration.
|
|
40
|
+
* See [type@GLib.Error] for more information on error domains.
|
|
40
41
|
*
|
|
41
42
|
* Note that this error domain is intended only for
|
|
42
43
|
* returning errors from a remote message bus process. Errors
|
|
43
|
-
* generated locally in-process by
|
|
44
|
-
*
|
|
44
|
+
* generated locally in-process (for example, by [class@Gio.DBusConnection])
|
|
45
|
+
* should use the [error@Gio.IOErrorEnum] domain.
|
|
45
46
|
*
|
|
46
47
|
* Since: 2.26
|
|
47
48
|
*/
|
|
@@ -60,10 +61,10 @@ gboolean g_dbus_error_strip_remote_error (GError *error);
|
|
|
60
61
|
|
|
61
62
|
/**
|
|
62
63
|
* GDBusErrorEntry:
|
|
63
|
-
* @error_code:
|
|
64
|
-
* @dbus_error_name:
|
|
64
|
+
* @error_code: an error code
|
|
65
|
+
* @dbus_error_name: the D-Bus error name to associate with @error_code
|
|
65
66
|
*
|
|
66
|
-
* Struct used in
|
|
67
|
+
* Struct used in [func@Gio.DBusError.register_error_domain].
|
|
67
68
|
*
|
|
68
69
|
* Since: 2.26
|
|
69
70
|
*/
|
|
@@ -71,6 +71,12 @@ GInetAddress * g_inet_address_new_from_bytes (const guint8
|
|
|
71
71
|
GIO_AVAILABLE_IN_ALL
|
|
72
72
|
GInetAddress * g_inet_address_new_loopback (GSocketFamily family);
|
|
73
73
|
|
|
74
|
+
GIO_AVAILABLE_IN_2_86
|
|
75
|
+
GInetAddress * g_inet_address_new_from_bytes_with_ipv6_info (const guint8 *bytes,
|
|
76
|
+
GSocketFamily family,
|
|
77
|
+
guint32 flowinfo,
|
|
78
|
+
guint32 scope_id);
|
|
79
|
+
|
|
74
80
|
GIO_AVAILABLE_IN_ALL
|
|
75
81
|
GInetAddress * g_inet_address_new_any (GSocketFamily family);
|
|
76
82
|
|
|
@@ -120,6 +126,12 @@ gboolean g_inet_address_get_is_mc_org_local (GInetAddress
|
|
|
120
126
|
GIO_AVAILABLE_IN_ALL
|
|
121
127
|
gboolean g_inet_address_get_is_mc_site_local (GInetAddress *address);
|
|
122
128
|
|
|
129
|
+
GIO_AVAILABLE_IN_2_86
|
|
130
|
+
guint32 g_inet_address_get_scope_id (GInetAddress *address);
|
|
131
|
+
|
|
132
|
+
GIO_AVAILABLE_IN_2_86
|
|
133
|
+
guint32 g_inet_address_get_flowinfo (GInetAddress *address);
|
|
134
|
+
|
|
123
135
|
G_END_DECLS
|
|
124
136
|
|
|
125
137
|
#endif /* __G_INET_ADDRESS_H__ */
|
|
@@ -987,13 +987,20 @@ typedef enum
|
|
|
987
987
|
* @G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT: Allow another message bus connection to claim the name.
|
|
988
988
|
* @G_BUS_NAME_OWNER_FLAGS_REPLACE: If another message bus connection owns the name and have
|
|
989
989
|
* specified %G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT, then take the name from the other connection.
|
|
990
|
-
* @G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE: If another message bus connection owns the name, immediately
|
|
991
|
-
* return an error from g_bus_own_name() rather than entering the waiting queue for that name. (Since 2.54)
|
|
992
990
|
*
|
|
993
991
|
* Flags used in g_bus_own_name().
|
|
994
992
|
*
|
|
995
993
|
* Since: 2.26
|
|
996
994
|
*/
|
|
995
|
+
/**
|
|
996
|
+
* G_BUS_NAME_OWNER_FLAGS_DO_NOT_QUEUE:
|
|
997
|
+
*
|
|
998
|
+
* If another message bus connection owns the name, immediately return an error
|
|
999
|
+
* from [func@Gio.bus_own_name] rather than entering the waiting queue for that
|
|
1000
|
+
* name.
|
|
1001
|
+
*
|
|
1002
|
+
* Since: 2.54
|
|
1003
|
+
**/
|
|
997
1004
|
typedef enum
|
|
998
1005
|
{
|
|
999
1006
|
G_BUS_NAME_OWNER_FLAGS_NONE = 0, /*< nick=none >*/
|
|
@@ -234,10 +234,10 @@ g_string_append_len_inline (GString *gstring,
|
|
|
234
234
|
else
|
|
235
235
|
len_unsigned = (gsize) len;
|
|
236
236
|
|
|
237
|
-
if (G_LIKELY (
|
|
237
|
+
if (G_LIKELY (len_unsigned < gstring->allocated_len - gstring->len))
|
|
238
238
|
{
|
|
239
239
|
char *end = gstring->str + gstring->len;
|
|
240
|
-
if (G_LIKELY (val + len_unsigned <= end || val
|
|
240
|
+
if (G_LIKELY (val + len_unsigned <= end || val >= end + len_unsigned))
|
|
241
241
|
memcpy (end, val, len_unsigned);
|
|
242
242
|
else
|
|
243
243
|
memmove (end, val, len_unsigned);
|
|
@@ -32,53 +32,61 @@ G_BEGIN_DECLS
|
|
|
32
32
|
/* --- type macros --- */
|
|
33
33
|
/**
|
|
34
34
|
* G_TYPE_IS_VALUE:
|
|
35
|
-
* @type:
|
|
35
|
+
* @type: a type
|
|
36
36
|
*
|
|
37
|
-
* Checks whether the passed in type ID can be used for
|
|
37
|
+
* Checks whether the passed in type ID can be used for
|
|
38
|
+
* [method@GObject.Value.init].
|
|
38
39
|
*
|
|
39
40
|
* That is, this macro checks whether this type provides an implementation
|
|
40
|
-
* of the
|
|
41
|
+
* of the [struct@GObject.TypeValueTable] functions required to be able to
|
|
42
|
+
* create a [struct@GObject.Value] instance.
|
|
41
43
|
*
|
|
42
|
-
* Returns: Whether @type is suitable as a
|
|
44
|
+
* Returns: Whether @type is suitable as a [struct@GObject.Value] type.
|
|
43
45
|
*/
|
|
44
46
|
#define G_TYPE_IS_VALUE(type) (g_type_check_is_value_type (type))
|
|
47
|
+
|
|
45
48
|
/**
|
|
46
49
|
* G_IS_VALUE:
|
|
47
|
-
* @value:
|
|
50
|
+
* @value: a [struct@GObject.Value] structure
|
|
48
51
|
*
|
|
49
|
-
* Checks if @value is a valid and initialized
|
|
52
|
+
* Checks if @value is a valid and initialized [struct@GObject.Value] structure.
|
|
50
53
|
*
|
|
51
|
-
* Returns:
|
|
54
|
+
* Returns: true on success; false otherwise
|
|
52
55
|
*/
|
|
53
56
|
#define G_IS_VALUE(value) (G_TYPE_CHECK_VALUE (value))
|
|
57
|
+
|
|
54
58
|
/**
|
|
55
59
|
* G_VALUE_TYPE:
|
|
56
|
-
* @value:
|
|
60
|
+
* @value: a [struct@GObject.Value] structure
|
|
57
61
|
*
|
|
58
62
|
* Get the type identifier of @value.
|
|
59
63
|
*
|
|
60
|
-
* Returns: the
|
|
64
|
+
* Returns: the type ID
|
|
61
65
|
*/
|
|
62
66
|
#define G_VALUE_TYPE(value) (((GValue*) (value))->g_type)
|
|
67
|
+
|
|
63
68
|
/**
|
|
64
69
|
* G_VALUE_TYPE_NAME:
|
|
65
|
-
* @value:
|
|
70
|
+
* @value: a [struct@GObject.Value] structure
|
|
66
71
|
*
|
|
67
|
-
* Gets the
|
|
72
|
+
* Gets the name of the type of @value.
|
|
68
73
|
*
|
|
69
|
-
* Returns: the type name
|
|
74
|
+
* Returns: the type name
|
|
70
75
|
*/
|
|
71
76
|
#define G_VALUE_TYPE_NAME(value) (g_type_name (G_VALUE_TYPE (value)))
|
|
77
|
+
|
|
72
78
|
/**
|
|
73
79
|
* G_VALUE_HOLDS:
|
|
74
|
-
* @value:
|
|
75
|
-
* @type:
|
|
80
|
+
* @value: (not nullable): a [struct@GObject.Value] structure
|
|
81
|
+
* @type: a [type@GObject.Type]
|
|
76
82
|
*
|
|
77
|
-
* Checks if @value holds
|
|
78
|
-
*
|
|
83
|
+
* Checks if @value holds a value of @type.
|
|
84
|
+
*
|
|
85
|
+
* This macro will also check for `value != NULL` and issue a
|
|
79
86
|
* warning if the check fails.
|
|
80
87
|
*
|
|
81
|
-
* Returns:
|
|
88
|
+
* Returns: true if @value is non-`NULL` and holds a value of the given @type;
|
|
89
|
+
* false otherwise
|
|
82
90
|
*/
|
|
83
91
|
#define G_VALUE_HOLDS(value,type) (G_TYPE_CHECK_VALUE_TYPE ((value), (type)))
|
|
84
92
|
|
|
@@ -86,29 +94,39 @@ G_BEGIN_DECLS
|
|
|
86
94
|
/* --- typedefs & structures --- */
|
|
87
95
|
/**
|
|
88
96
|
* GValueTransform:
|
|
89
|
-
* @src_value:
|
|
90
|
-
* @dest_value:
|
|
97
|
+
* @src_value: source value
|
|
98
|
+
* @dest_value: target value
|
|
91
99
|
*
|
|
92
100
|
* The type of value transformation functions which can be registered with
|
|
93
|
-
*
|
|
101
|
+
* [func@GObject.Value.register_transform_func].
|
|
94
102
|
*
|
|
95
103
|
* @dest_value will be initialized to the correct destination type.
|
|
96
104
|
*/
|
|
97
105
|
typedef void (*GValueTransform) (const GValue *src_value,
|
|
98
106
|
GValue *dest_value);
|
|
107
|
+
|
|
99
108
|
/**
|
|
100
109
|
* GValue:
|
|
101
110
|
*
|
|
102
111
|
* An opaque structure used to hold different types of values.
|
|
103
112
|
*
|
|
113
|
+
* Before it can be used, a `GValue` has to be initialized to a specific type by
|
|
114
|
+
* calling [method@GObject.Value.init] on it.
|
|
115
|
+
*
|
|
116
|
+
* Many types which are stored within a `GValue` need to allocate data on the
|
|
117
|
+
* heap, so [method@GObject.Value.unset] must always be called on a `GValue` to
|
|
118
|
+
* free any such data once you’re finished with the `GValue`, even if the
|
|
119
|
+
* `GValue` itself is stored on the stack.
|
|
120
|
+
*
|
|
104
121
|
* The data within the structure has protected scope: it is accessible only
|
|
105
|
-
* to functions within a
|
|
106
|
-
* the g_value_*() API. That is, code
|
|
107
|
-
* types.
|
|
122
|
+
* to functions within a [struct@GObject.TypeValueTable] structure, or
|
|
123
|
+
* implementations of the `g_value_*()` API. That is, code which implements new
|
|
124
|
+
* fundamental types.
|
|
108
125
|
*
|
|
109
|
-
*
|
|
126
|
+
* `GValue` users cannot make any assumptions about how data is stored
|
|
110
127
|
* within the 2 element @data union, and the @g_type member should
|
|
111
|
-
* only be accessed through the
|
|
128
|
+
* only be accessed through the [func@GObject.VALUE_TYPE] macro and related
|
|
129
|
+
* macros.
|
|
112
130
|
*/
|
|
113
131
|
struct _GValue
|
|
114
132
|
{
|
|
@@ -174,18 +192,32 @@ void g_value_register_transform_func (GType src_type,
|
|
|
174
192
|
/**
|
|
175
193
|
* G_VALUE_NOCOPY_CONTENTS:
|
|
176
194
|
*
|
|
177
|
-
*
|
|
178
|
-
*
|
|
179
|
-
*
|
|
195
|
+
* Flag to indicate that allocated data in a [struct@GObject.Value] shouldn’t be
|
|
196
|
+
* copied.
|
|
197
|
+
*
|
|
198
|
+
* If passed to [func@GObject.VALUE_COLLECT], allocated data won’t be copied
|
|
199
|
+
* but used verbatim. This does not affect ref-counted types like objects.
|
|
200
|
+
*
|
|
201
|
+
* This does not affect usage of [method@GObject.Value.copy]: the data will
|
|
180
202
|
* be copied if it is not ref-counted.
|
|
203
|
+
*
|
|
204
|
+
* This flag should be checked by implementations of
|
|
205
|
+
* [callback@GObject.TypeValueFreeFunc], [callback@GObject.TypeValueCollectFunc]
|
|
206
|
+
* and [callback@GObject.TypeValueLCopyFunc].
|
|
181
207
|
*/
|
|
182
208
|
#define G_VALUE_NOCOPY_CONTENTS (1 << 27)
|
|
183
209
|
|
|
184
210
|
/**
|
|
185
211
|
* G_VALUE_INTERNED_STRING:
|
|
186
212
|
*
|
|
187
|
-
*
|
|
188
|
-
* exist for the duration of the process.
|
|
213
|
+
* Flag to indicate that a string in a [struct@GObject.Value] is canonical and
|
|
214
|
+
* will exist for the duration of the process.
|
|
215
|
+
*
|
|
216
|
+
* See [method@GObject.Value.set_interned_string].
|
|
217
|
+
*
|
|
218
|
+
* This flag should be checked by implementations of
|
|
219
|
+
* [callback@GObject.TypeValueFreeFunc], [callback@GObject.TypeValueCollectFunc]
|
|
220
|
+
* and [callback@GObject.TypeValueLCopyFunc].
|
|
189
221
|
*
|
|
190
222
|
* Since: 2.66
|
|
191
223
|
*/
|
|
@@ -194,13 +226,24 @@ void g_value_register_transform_func (GType src_type,
|
|
|
194
226
|
/**
|
|
195
227
|
* G_VALUE_INIT:
|
|
196
228
|
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
229
|
+
* Clears a [struct@GObject.Value] to zero at declaration time.
|
|
230
|
+
*
|
|
231
|
+
* A [struct@GObject.Value] must be cleared and then initialized before it can
|
|
232
|
+
* be used. This macro can be assigned to a variable instead of an explicit
|
|
233
|
+
* `{ 0 }` when declaring it, but it cannot be assigned to a variable after
|
|
234
|
+
* declaration time.
|
|
200
235
|
*
|
|
201
|
-
*
|
|
236
|
+
* After the [struct@GObject.Value] is cleared, it must be initialized by
|
|
237
|
+
* calling [method@GObject.Value.init] on it before any other methods can be
|
|
238
|
+
* called on it.
|
|
239
|
+
*
|
|
240
|
+
* ```c
|
|
202
241
|
* GValue value = G_VALUE_INIT;
|
|
203
|
-
*
|
|
242
|
+
*
|
|
243
|
+
* g_value_init (&value, SOME_G_TYPE);
|
|
244
|
+
* …
|
|
245
|
+
* g_value_unset (&value);
|
|
246
|
+
* ```
|
|
204
247
|
*
|
|
205
248
|
* Since: 2.30
|
|
206
249
|
*/
|
package/include/hwy/abort.h
CHANGED
|
@@ -5,24 +5,7 @@
|
|
|
5
5
|
#ifndef HIGHWAY_HWY_ABORT_H_
|
|
6
6
|
#define HIGHWAY_HWY_ABORT_H_
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
namespace hwy {
|
|
11
|
-
|
|
12
|
-
// Interface for custom abort handler
|
|
13
|
-
typedef void (*AbortFunc)(const char* file, int line,
|
|
14
|
-
const char* formatted_err);
|
|
15
|
-
|
|
16
|
-
// Retrieve current abort handler
|
|
17
|
-
// Returns null if no abort handler registered, indicating Highway should print and abort
|
|
18
|
-
HWY_DLLEXPORT AbortFunc& GetAbortFunc();
|
|
19
|
-
|
|
20
|
-
// Sets a new abort handler and returns the previous abort handler
|
|
21
|
-
// If this handler does not do the aborting itself Highway will use its own abort mechanism
|
|
22
|
-
// which allows this to be used to customize the handling of the error itself.
|
|
23
|
-
// Returns null if no previous abort handler registered
|
|
24
|
-
HWY_DLLEXPORT AbortFunc SetAbortFunc(AbortFunc func);
|
|
25
|
-
|
|
26
|
-
} // namespace hwy
|
|
8
|
+
// Empty header for compatibility.
|
|
9
|
+
// All Abort/Warn functionalities are in base.h.
|
|
27
10
|
|
|
28
11
|
#endif // HIGHWAY_HWY_ABORT_H_
|
|
@@ -40,6 +40,7 @@ namespace hwy {
|
|
|
40
40
|
// access pairs of lines, and M1 L2 and POWER8 lines are also 128 bytes.
|
|
41
41
|
#define HWY_ALIGNMENT 128
|
|
42
42
|
|
|
43
|
+
// `align` is in bytes.
|
|
43
44
|
template <typename T>
|
|
44
45
|
HWY_API constexpr bool IsAligned(T* ptr, size_t align = HWY_ALIGNMENT) {
|
|
45
46
|
return reinterpret_cast<uintptr_t>(ptr) % align == 0;
|
|
@@ -181,14 +182,14 @@ static inline constexpr size_t ShiftCount(size_t n) {
|
|
|
181
182
|
|
|
182
183
|
template <typename T>
|
|
183
184
|
T* AllocateAlignedItems(size_t items, AllocPtr alloc_ptr, void* opaque_ptr) {
|
|
184
|
-
constexpr size_t
|
|
185
|
+
constexpr size_t kSize = sizeof(T);
|
|
185
186
|
|
|
186
|
-
constexpr bool
|
|
187
|
-
constexpr size_t
|
|
188
|
-
static_assert(!
|
|
187
|
+
constexpr bool kIsPow2 = (kSize & (kSize - 1)) == 0;
|
|
188
|
+
constexpr size_t kBits = ShiftCount(kSize);
|
|
189
|
+
static_assert(!kIsPow2 || (1ull << kBits) == kSize, "ShiftCount has a bug");
|
|
189
190
|
|
|
190
|
-
const size_t bytes =
|
|
191
|
-
const size_t check =
|
|
191
|
+
const size_t bytes = kIsPow2 ? items << kBits : items * kSize;
|
|
192
|
+
const size_t check = kIsPow2 ? bytes >> kBits : bytes / kSize;
|
|
192
193
|
if (check != items) {
|
|
193
194
|
return nullptr; // overflowed
|
|
194
195
|
}
|
|
@@ -232,7 +233,6 @@ class AlignedFreer {
|
|
|
232
233
|
|
|
233
234
|
template <typename T>
|
|
234
235
|
void operator()(T* aligned_pointer) const {
|
|
235
|
-
// TODO(deymo): assert that we are using a POD type T.
|
|
236
236
|
FreeAlignedBytes(aligned_pointer, free_, opaque_ptr_);
|
|
237
237
|
}
|
|
238
238
|
|
|
@@ -251,6 +251,10 @@ using AlignedFreeUniquePtr = std::unique_ptr<T, AlignedFreer>;
|
|
|
251
251
|
template <typename T>
|
|
252
252
|
AlignedFreeUniquePtr<T[]> AllocateAligned(const size_t items, AllocPtr alloc,
|
|
253
253
|
FreePtr free, void* opaque) {
|
|
254
|
+
static_assert(std::is_trivially_copyable<T>::value,
|
|
255
|
+
"AllocateAligned: requires trivially copyable T");
|
|
256
|
+
static_assert(std::is_trivially_destructible<T>::value,
|
|
257
|
+
"AllocateAligned: requires trivially destructible T");
|
|
254
258
|
return AlignedFreeUniquePtr<T[]>(
|
|
255
259
|
detail::AllocateAlignedItems<T>(items, alloc, opaque),
|
|
256
260
|
AlignedFreer(free, opaque));
|