@img/sharp-libvips-dev 1.0.1 → 1.0.2
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/expat.h +21 -10
- package/include/expat_config.h +11 -5
- package/include/ffi.h +12 -25
- package/include/freetype2/freetype/config/ftoption.h +1 -1
- package/include/gio-unix-2.0/gio/gfiledescriptorbased.h +3 -2
- package/include/glib-2.0/gio/gapplication.h +6 -0
- package/include/glib-2.0/gio/giotypes.h +0 -1
- package/include/glib-2.0/girepository/giarginfo.h +23 -6
- package/include/glib-2.0/girepository/gibaseinfo.h +44 -18
- package/include/glib-2.0/girepository/gicallableinfo.h +26 -16
- package/include/glib-2.0/girepository/gicallbackinfo.h +17 -2
- package/include/glib-2.0/girepository/giconstantinfo.h +19 -4
- package/include/glib-2.0/girepository/gienuminfo.h +20 -21
- package/include/glib-2.0/girepository/gifieldinfo.h +22 -7
- package/include/glib-2.0/girepository/giflagsinfo.h +60 -0
- package/include/glib-2.0/girepository/gifunctioninfo.h +22 -7
- package/include/glib-2.0/girepository/giinterfaceinfo.h +33 -18
- package/include/glib-2.0/girepository/giobjectinfo.h +41 -26
- package/include/glib-2.0/girepository/gipropertyinfo.h +18 -3
- package/include/glib-2.0/girepository/giregisteredtypeinfo.h +22 -11
- package/include/glib-2.0/girepository/girepository-autocleanups.h +56 -0
- package/include/glib-2.0/girepository/girepository.h +53 -62
- package/include/glib-2.0/girepository/girffi.h +8 -7
- package/include/glib-2.0/girepository/gisignalinfo.h +18 -3
- package/include/glib-2.0/girepository/gistructinfo.h +26 -11
- package/include/glib-2.0/girepository/gitypeinfo.h +29 -16
- package/include/glib-2.0/girepository/gitypelib.h +9 -13
- package/include/glib-2.0/girepository/gitypes.h +52 -104
- package/include/glib-2.0/girepository/giunioninfo.h +28 -12
- package/include/glib-2.0/girepository/giunresolvedinfo.h +17 -2
- package/include/glib-2.0/girepository/givalueinfo.h +65 -0
- package/include/glib-2.0/girepository/givfuncinfo.h +23 -8
- package/include/glib-2.0/glib/deprecated/gthread.h +9 -5
- package/include/glib-2.0/glib/gbitlock.h +31 -0
- package/include/glib-2.0/glib/gmessages.h +8 -0
- package/include/glib-2.0/glib/gslice.h +2 -0
- package/include/glib-2.0/glib/gstrfuncs.h +24 -18
- package/include/glib-2.0/glib/gthread.h +191 -3
- package/include/glib-2.0/glib-unix.h +7 -1
- package/include/glib-2.0/gobject/genums.h +6 -6
- package/include/glib-2.0/gobject/glib-types.h +11 -0
- package/include/glib-2.0/gobject/gsignal.h +16 -6
- package/include/hwy/aligned_allocator.h +171 -6
- package/include/hwy/base.h +1765 -543
- package/include/hwy/cache_control.h +24 -6
- package/include/hwy/detect_compiler_arch.h +23 -2
- package/include/hwy/detect_targets.h +56 -13
- package/include/hwy/foreach_target.h +24 -0
- package/include/hwy/highway.h +20 -3
- package/include/hwy/ops/arm_neon-inl.h +1086 -667
- package/include/hwy/ops/arm_sve-inl.h +1091 -235
- package/include/hwy/ops/emu128-inl.h +271 -196
- package/include/hwy/ops/generic_ops-inl.h +2270 -399
- package/include/hwy/ops/ppc_vsx-inl.h +1786 -563
- package/include/hwy/ops/rvv-inl.h +1043 -311
- package/include/hwy/ops/scalar-inl.h +189 -159
- package/include/hwy/ops/set_macros-inl.h +66 -6
- package/include/hwy/ops/shared-inl.h +175 -56
- package/include/hwy/ops/wasm_128-inl.h +153 -136
- package/include/hwy/ops/x86_128-inl.h +1647 -646
- package/include/hwy/ops/x86_256-inl.h +1003 -370
- package/include/hwy/ops/x86_512-inl.h +948 -353
- package/include/hwy/per_target.h +4 -0
- package/include/hwy/profiler.h +648 -0
- package/include/hwy/robust_statistics.h +2 -2
- package/include/hwy/targets.h +18 -11
- package/include/hwy/timer.h +11 -0
- package/include/libpng16/png.h +32 -29
- package/include/libpng16/pngconf.h +2 -2
- package/include/libpng16/pnglibconf.h +7 -2
- package/include/librsvg-2.0/librsvg/rsvg-version.h +2 -2
- package/include/libxml2/libxml/parser.h +16 -7
- package/include/libxml2/libxml/xmlIO.h +0 -1
- package/include/libxml2/libxml/xmlversion.h +4 -4
- package/include/pango-1.0/pango/pango-features.h +3 -3
- package/include/pango-1.0/pango/pango-fontmap.h +7 -0
- package/include/pixman-1/pixman-version.h +2 -2
- package/include/png.h +32 -29
- package/include/pngconf.h +2 -2
- package/include/pnglibconf.h +7 -2
- package/include/vips/connection.h +9 -3
- package/include/vips/util.h +0 -9
- package/include/vips/version.h +4 -4
- package/package.json +1 -1
- package/versions.json +11 -11
|
@@ -139,6 +139,10 @@ struct _GOnce
|
|
|
139
139
|
# define G_TRYLOCK(name) g_mutex_trylock (&G_LOCK_NAME (name))
|
|
140
140
|
#endif /* !G_DEBUG_LOCKS */
|
|
141
141
|
|
|
142
|
+
#ifdef g_autoptr
|
|
143
|
+
#define G_AUTO_LOCK(name) G_MUTEX_AUTO_LOCK (&G_LOCK_NAME (name), g__##name##_locker)
|
|
144
|
+
#endif /* g_autoptr */
|
|
145
|
+
|
|
142
146
|
GLIB_AVAILABLE_IN_2_32
|
|
143
147
|
GThread * g_thread_ref (GThread *thread);
|
|
144
148
|
GLIB_AVAILABLE_IN_2_32
|
|
@@ -339,7 +343,7 @@ typedef void GMutexLocker;
|
|
|
339
343
|
*
|
|
340
344
|
* // Code with mutex locked here
|
|
341
345
|
*
|
|
342
|
-
* if (
|
|
346
|
+
* if (condition)
|
|
343
347
|
* // No need to unlock
|
|
344
348
|
* return;
|
|
345
349
|
*
|
|
@@ -350,6 +354,10 @@ typedef void GMutexLocker;
|
|
|
350
354
|
* }
|
|
351
355
|
* ]|
|
|
352
356
|
*
|
|
357
|
+
* Note that it is common for the declared variable to not be used in the scope,
|
|
358
|
+
* which causes some compilers to warn. That can be avoided by using
|
|
359
|
+
* `G_GNUC_UNUSED` or, since 2.80, [func@GLib.MUTEX_AUTO_LOCK].
|
|
360
|
+
*
|
|
353
361
|
* Returns: a #GMutexLocker
|
|
354
362
|
* Since: 2.44
|
|
355
363
|
*/
|
|
@@ -378,6 +386,49 @@ g_mutex_locker_free (GMutexLocker *locker)
|
|
|
378
386
|
g_mutex_unlock ((GMutex *) locker);
|
|
379
387
|
}
|
|
380
388
|
|
|
389
|
+
/**
|
|
390
|
+
* G_MUTEX_AUTO_LOCK:
|
|
391
|
+
* @mutex: a [type@GLib.Mutex]
|
|
392
|
+
* @var: a variable name to be declared
|
|
393
|
+
*
|
|
394
|
+
* Declare a [type@GLib.MutexLocker] variable with `g_autoptr()` and lock the
|
|
395
|
+
* mutex. The mutex will be unlocked automatically when leaving the scope. The
|
|
396
|
+
* variable is declared with `G_GNUC_UNUSED` to avoid compiler warning if it is
|
|
397
|
+
* not used in the scope.
|
|
398
|
+
*
|
|
399
|
+
* This feature is only supported on GCC and clang. This macro is not defined on
|
|
400
|
+
* other compilers and should not be used in programs that are intended to be
|
|
401
|
+
* portable to those compilers.
|
|
402
|
+
*
|
|
403
|
+
* Note that this should be used in a place where it is allowed to declare a
|
|
404
|
+
* variable, which could be before any statement in the case
|
|
405
|
+
* `-Wdeclaration-after-statement` is used, or C standard prior to C99.
|
|
406
|
+
*
|
|
407
|
+
* ```c
|
|
408
|
+
* {
|
|
409
|
+
* G_MUTEX_AUTO_LOCK (&obj->mutex, locker);
|
|
410
|
+
*
|
|
411
|
+
* obj->stuff_with_lock ();
|
|
412
|
+
* if (condition)
|
|
413
|
+
* {
|
|
414
|
+
* // No need to unlock
|
|
415
|
+
* return;
|
|
416
|
+
* }
|
|
417
|
+
*
|
|
418
|
+
* // Unlock before end of scope
|
|
419
|
+
* g_clear_pointer (&locker, g_mutex_locker_free);
|
|
420
|
+
* obj->stuff_without_lock ();
|
|
421
|
+
* }
|
|
422
|
+
* ```
|
|
423
|
+
*
|
|
424
|
+
* Since: 2.80.0
|
|
425
|
+
*/
|
|
426
|
+
#ifdef g_autoptr
|
|
427
|
+
#define G_MUTEX_AUTO_LOCK(mutex, var) \
|
|
428
|
+
GLIB_AVAILABLE_MACRO_IN_2_80 g_autoptr (GMutexLocker) \
|
|
429
|
+
G_GNUC_UNUSED var = g_mutex_locker_new (mutex)
|
|
430
|
+
#endif /* g_autoptr */
|
|
431
|
+
|
|
381
432
|
/**
|
|
382
433
|
* GRecMutexLocker:
|
|
383
434
|
*
|
|
@@ -414,7 +465,7 @@ typedef void GRecMutexLocker;
|
|
|
414
465
|
*
|
|
415
466
|
* // Code with rec_mutex locked here
|
|
416
467
|
*
|
|
417
|
-
* if (
|
|
468
|
+
* if (condition)
|
|
418
469
|
* // No need to unlock
|
|
419
470
|
* return;
|
|
420
471
|
*
|
|
@@ -425,6 +476,10 @@ typedef void GRecMutexLocker;
|
|
|
425
476
|
* }
|
|
426
477
|
* ]|
|
|
427
478
|
*
|
|
479
|
+
* Note that it is common for the declared variable to not be used in the scope,
|
|
480
|
+
* which causes some compilers to warn. That can be avoided by using
|
|
481
|
+
* `G_GNUC_UNUSED` or, since 2.80, [func@GLib.REC_MUTEX_AUTO_LOCK].
|
|
482
|
+
*
|
|
428
483
|
* Returns: a #GRecMutexLocker
|
|
429
484
|
* Since: 2.60
|
|
430
485
|
*/
|
|
@@ -457,6 +512,49 @@ g_rec_mutex_locker_free (GRecMutexLocker *locker)
|
|
|
457
512
|
}
|
|
458
513
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
459
514
|
|
|
515
|
+
/**
|
|
516
|
+
* G_REC_MUTEX_AUTO_LOCK:
|
|
517
|
+
* @mutex: a [type@GLib.RecMutex]
|
|
518
|
+
* @var: a variable name to be declared
|
|
519
|
+
*
|
|
520
|
+
* Declare a [type@GLib.RecMutexLocker] variable with `g_autoptr()` and lock the
|
|
521
|
+
* mutex. The mutex will be unlocked automatically when leaving the scope. The
|
|
522
|
+
* variable is declared with `G_GNUC_UNUSED` to avoid compiler warning if it is
|
|
523
|
+
* not used in the scope.
|
|
524
|
+
*
|
|
525
|
+
* This feature is only supported on GCC and clang. This macro is not defined on
|
|
526
|
+
* other compilers and should not be used in programs that are intended to be
|
|
527
|
+
* portable to those compilers.
|
|
528
|
+
*
|
|
529
|
+
* Note that this should be used in a place where it is allowed to declare a
|
|
530
|
+
* variable, which could be before any statement in the case
|
|
531
|
+
* `-Wdeclaration-after-statement` is used, or C standard prior to C99.
|
|
532
|
+
*
|
|
533
|
+
* ```c
|
|
534
|
+
* {
|
|
535
|
+
* G_REC_MUTEX_AUTO_LOCK (&obj->rec_mutex, locker);
|
|
536
|
+
*
|
|
537
|
+
* obj->stuff_with_lock ();
|
|
538
|
+
* if (condition)
|
|
539
|
+
* {
|
|
540
|
+
* // No need to unlock
|
|
541
|
+
* return;
|
|
542
|
+
* }
|
|
543
|
+
*
|
|
544
|
+
* // Unlock before end of scope
|
|
545
|
+
* g_clear_pointer (&locker, g_rec_mutex_locker_free);
|
|
546
|
+
* obj->stuff_without_lock ();
|
|
547
|
+
* }
|
|
548
|
+
* ```
|
|
549
|
+
*
|
|
550
|
+
* Since: 2.80.0
|
|
551
|
+
*/
|
|
552
|
+
#ifdef g_autoptr
|
|
553
|
+
#define G_REC_MUTEX_AUTO_LOCK(mutex, var) \
|
|
554
|
+
GLIB_AVAILABLE_MACRO_IN_2_80 g_autoptr (GRecMutexLocker) \
|
|
555
|
+
G_GNUC_UNUSED var = g_rec_mutex_locker_new (mutex)
|
|
556
|
+
#endif /* g_autoptr */
|
|
557
|
+
|
|
460
558
|
/**
|
|
461
559
|
* GRWLockWriterLocker:
|
|
462
560
|
*
|
|
@@ -520,7 +618,7 @@ typedef void GRWLockWriterLocker;
|
|
|
520
618
|
* if (self->array == NULL)
|
|
521
619
|
* self->array = g_ptr_array_new ();
|
|
522
620
|
*
|
|
523
|
-
* if (
|
|
621
|
+
* if (condition)
|
|
524
622
|
* // No need to unlock
|
|
525
623
|
* return;
|
|
526
624
|
*
|
|
@@ -535,6 +633,10 @@ typedef void GRWLockWriterLocker;
|
|
|
535
633
|
* }
|
|
536
634
|
* ]|
|
|
537
635
|
*
|
|
636
|
+
* Note that it is common for the declared variable to not be used in the scope,
|
|
637
|
+
* which causes some compilers to warn. That can be avoided by using
|
|
638
|
+
* `G_GNUC_UNUSED` or, since 2.80, [func@GLib.RW_LOCK_WRITER_AUTO_LOCK].
|
|
639
|
+
*
|
|
538
640
|
* Returns: a #GRWLockWriterLocker
|
|
539
641
|
* Since: 2.62
|
|
540
642
|
*/
|
|
@@ -568,6 +670,49 @@ g_rw_lock_writer_locker_free (GRWLockWriterLocker *locker)
|
|
|
568
670
|
}
|
|
569
671
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
570
672
|
|
|
673
|
+
/**
|
|
674
|
+
* G_RW_LOCK_WRITER_AUTO_LOCK:
|
|
675
|
+
* @mutex: a [type@GLib.RWLock]
|
|
676
|
+
* @var: a variable name to be declared
|
|
677
|
+
*
|
|
678
|
+
* Declare a [type@GLib.RWLockWriterLocker] variable with `g_autoptr()` and lock
|
|
679
|
+
* for writing. The mutex will be unlocked automatically when leaving the scope.
|
|
680
|
+
* The variable is declared with `G_GNUC_UNUSED` to avoid compiler warning if it
|
|
681
|
+
* is not used in the scope.
|
|
682
|
+
*
|
|
683
|
+
* This feature is only supported on GCC and clang. This macro is not defined on
|
|
684
|
+
* other compilers and should not be used in programs that are intended to be
|
|
685
|
+
* portable to those compilers.
|
|
686
|
+
*
|
|
687
|
+
* Note that this should be used in a place where it is allowed to declare a
|
|
688
|
+
* variable, which could be before any statement in the case
|
|
689
|
+
* `-Wdeclaration-after-statement` is used, or C standard prior to C99.
|
|
690
|
+
*
|
|
691
|
+
* ```c
|
|
692
|
+
* {
|
|
693
|
+
* G_RW_LOCK_WRITER_AUTO_LOCK (&obj->rw_lock, locker);
|
|
694
|
+
*
|
|
695
|
+
* obj->stuff_with_lock ();
|
|
696
|
+
* if (condition)
|
|
697
|
+
* {
|
|
698
|
+
* // No need to unlock
|
|
699
|
+
* return;
|
|
700
|
+
* }
|
|
701
|
+
*
|
|
702
|
+
* // Unlock before end of scope
|
|
703
|
+
* g_clear_pointer (&locker, g_rw_lock_writer_locker_free);
|
|
704
|
+
* obj->stuff_without_lock ();
|
|
705
|
+
* }
|
|
706
|
+
* ```
|
|
707
|
+
*
|
|
708
|
+
* Since: 2.80.0
|
|
709
|
+
*/
|
|
710
|
+
#ifdef g_autoptr
|
|
711
|
+
#define G_RW_LOCK_WRITER_AUTO_LOCK(mutex, var) \
|
|
712
|
+
GLIB_AVAILABLE_MACRO_IN_2_80 g_autoptr (GRWLockWriterLocker) \
|
|
713
|
+
G_GNUC_UNUSED var = g_rw_lock_writer_locker_new (mutex)
|
|
714
|
+
#endif /* g_autoptr */
|
|
715
|
+
|
|
571
716
|
/**
|
|
572
717
|
* GRWLockReaderLocker:
|
|
573
718
|
*
|
|
@@ -623,6 +768,49 @@ g_rw_lock_reader_locker_free (GRWLockReaderLocker *locker)
|
|
|
623
768
|
}
|
|
624
769
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
625
770
|
|
|
771
|
+
/**
|
|
772
|
+
* G_RW_LOCK_READER_AUTO_LOCK:
|
|
773
|
+
* @mutex: a [type@GLib.RWLock]
|
|
774
|
+
* @var: a variable name to be declared
|
|
775
|
+
*
|
|
776
|
+
* Declare a [type@GLib.RWLockReaderLocker] variable with `g_autoptr()` and lock
|
|
777
|
+
* for reading. The mutex will be unlocked automatically when leaving the scope.
|
|
778
|
+
* The variable is declared with `G_GNUC_UNUSED` to avoid compiler warning if it
|
|
779
|
+
* is not used in the scope.
|
|
780
|
+
*
|
|
781
|
+
* This feature is only supported on GCC and clang. This macro is not defined on
|
|
782
|
+
* other compilers and should not be used in programs that are intended to be
|
|
783
|
+
* portable to those compilers.
|
|
784
|
+
*
|
|
785
|
+
* Note that this should be used in a place where it is allowed to declare a
|
|
786
|
+
* variable, which could be before any statement in the case
|
|
787
|
+
* `-Wdeclaration-after-statement` is used, or C standard prior to C99.
|
|
788
|
+
*
|
|
789
|
+
* ```c
|
|
790
|
+
* {
|
|
791
|
+
* G_RW_LOCK_READER_AUTO_LOCK (&obj->rw_lock, locker);
|
|
792
|
+
*
|
|
793
|
+
* obj->stuff_with_lock ();
|
|
794
|
+
* if (condition)
|
|
795
|
+
* {
|
|
796
|
+
* // No need to unlock
|
|
797
|
+
* return;
|
|
798
|
+
* }
|
|
799
|
+
*
|
|
800
|
+
* // Unlock before end of scope
|
|
801
|
+
* g_clear_pointer (&locker, g_rw_lock_reader_locker_free);
|
|
802
|
+
* obj->stuff_without_lock ();
|
|
803
|
+
* }
|
|
804
|
+
* ```
|
|
805
|
+
*
|
|
806
|
+
* Since: 2.80.0
|
|
807
|
+
*/
|
|
808
|
+
#ifdef g_autoptr
|
|
809
|
+
#define G_RW_LOCK_READER_AUTO_LOCK(mutex, var) \
|
|
810
|
+
GLIB_AVAILABLE_MACRO_IN_2_80 g_autoptr (GRWLockReaderLocker) \
|
|
811
|
+
G_GNUC_UNUSED var = g_rw_lock_reader_locker_new (mutex)
|
|
812
|
+
#endif /* g_autoptr */
|
|
813
|
+
|
|
626
814
|
G_END_DECLS
|
|
627
815
|
|
|
628
816
|
#endif /* __G_THREAD_H__ */
|
|
@@ -173,7 +173,7 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
173
173
|
/**
|
|
174
174
|
* g_unix_pipe_open:
|
|
175
175
|
* @self: A pair of file descriptors
|
|
176
|
-
* @flags: Flags to pass to g_unix_open_pipe(), typically `
|
|
176
|
+
* @flags: Flags to pass to g_unix_open_pipe(), typically `O_CLOEXEC`
|
|
177
177
|
* @error: Used to report an error on failure
|
|
178
178
|
*
|
|
179
179
|
* Open a pipe. This is the same as g_unix_open_pipe(), but uses the
|
|
@@ -326,6 +326,12 @@ g_unix_pipe_clear (GUnixPipe *self)
|
|
|
326
326
|
|
|
327
327
|
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (GUnixPipe, g_unix_pipe_clear)
|
|
328
328
|
|
|
329
|
+
GLIB_AVAILABLE_IN_2_80
|
|
330
|
+
int g_closefrom (int lowfd);
|
|
331
|
+
|
|
332
|
+
GLIB_AVAILABLE_IN_2_80
|
|
333
|
+
int g_fdwalk_set_cloexec (int lowfd);
|
|
334
|
+
|
|
329
335
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
330
336
|
|
|
331
337
|
G_END_DECLS
|
|
@@ -320,14 +320,14 @@ void g_flags_complete_type_info (GType g_flags_type,
|
|
|
320
320
|
#define G_DEFINE_ENUM_TYPE(TypeName, type_name, ...) \
|
|
321
321
|
GType \
|
|
322
322
|
type_name ## _get_type (void) { \
|
|
323
|
-
static
|
|
324
|
-
if (
|
|
323
|
+
static _g_type_once_init_type g_define_type__static = 0; \
|
|
324
|
+
if (_g_type_once_init_enter (&g_define_type__static)) { \
|
|
325
325
|
static const GEnumValue enum_values[] = { \
|
|
326
326
|
__VA_ARGS__ , \
|
|
327
327
|
{ 0, NULL, NULL }, \
|
|
328
328
|
}; \
|
|
329
329
|
GType g_define_type = g_enum_register_static (g_intern_static_string (#TypeName), enum_values); \
|
|
330
|
-
|
|
330
|
+
_g_type_once_init_leave (&g_define_type__static, g_define_type); \
|
|
331
331
|
} \
|
|
332
332
|
return g_define_type__static; \
|
|
333
333
|
} \
|
|
@@ -363,14 +363,14 @@ type_name ## _get_type (void) { \
|
|
|
363
363
|
#define G_DEFINE_FLAGS_TYPE(TypeName, type_name, ...) \
|
|
364
364
|
GType \
|
|
365
365
|
type_name ## _get_type (void) { \
|
|
366
|
-
static
|
|
367
|
-
if (
|
|
366
|
+
static _g_type_once_init_type g_define_type__static = 0; \
|
|
367
|
+
if (_g_type_once_init_enter (&g_define_type__static)) { \
|
|
368
368
|
static const GFlagsValue flags_values[] = { \
|
|
369
369
|
__VA_ARGS__ , \
|
|
370
370
|
{ 0, NULL, NULL }, \
|
|
371
371
|
}; \
|
|
372
372
|
GType g_define_type = g_flags_register_static (g_intern_static_string (#TypeName), flags_values); \
|
|
373
|
-
|
|
373
|
+
_g_type_once_init_leave (&g_define_type__static, g_define_type); \
|
|
374
374
|
} \
|
|
375
375
|
return g_define_type__static; \
|
|
376
376
|
} \
|
|
@@ -345,6 +345,15 @@ typedef gsize GType;
|
|
|
345
345
|
*/
|
|
346
346
|
#define G_TYPE_DIR (g_dir_get_type ())
|
|
347
347
|
|
|
348
|
+
/**
|
|
349
|
+
* G_TYPE_RAND:
|
|
350
|
+
*
|
|
351
|
+
* The #GType for a boxed type holding a #GRand.
|
|
352
|
+
*
|
|
353
|
+
* Since: 2.80
|
|
354
|
+
*/
|
|
355
|
+
#define G_TYPE_RAND (g_rand_get_type ())
|
|
356
|
+
|
|
348
357
|
/**
|
|
349
358
|
* G_TYPE_STRV_BUILDER:
|
|
350
359
|
*
|
|
@@ -423,6 +432,8 @@ GType g_hmac_get_type (void) G_GNUC_CONST;
|
|
|
423
432
|
GOBJECT_AVAILABLE_IN_2_80
|
|
424
433
|
GType g_dir_get_type (void) G_GNUC_CONST;
|
|
425
434
|
GOBJECT_AVAILABLE_IN_2_80
|
|
435
|
+
GType g_rand_get_type (void) G_GNUC_CONST;
|
|
436
|
+
GOBJECT_AVAILABLE_IN_2_80
|
|
426
437
|
GType g_strv_builder_get_type (void) G_GNUC_CONST;
|
|
427
438
|
|
|
428
439
|
GOBJECT_DEPRECATED_FOR('G_TYPE_VARIANT')
|
|
@@ -500,14 +500,18 @@ void g_signal_chain_from_overridden_handler (gpointer instance,
|
|
|
500
500
|
* @c_handler: the #GCallback to connect.
|
|
501
501
|
* @data: data to pass to @c_handler calls.
|
|
502
502
|
*
|
|
503
|
-
* Connects a
|
|
503
|
+
* Connects a [type@GObject.Callback] function to a signal for a particular object.
|
|
504
504
|
*
|
|
505
|
-
* The handler will be called synchronously, before the default handler of the signal.
|
|
505
|
+
* The handler will be called synchronously, before the default handler of the signal.
|
|
506
|
+
* [func@GObject.signal_emit] will not return control until all handlers are called.
|
|
506
507
|
*
|
|
507
|
-
* See [memory management of signal handlers]
|
|
508
|
+
* See [memory management of signal handlers](signals.html#Memory_management_of_signal_handlers) for
|
|
508
509
|
* details on how to handle the return value and memory management of @data.
|
|
509
510
|
*
|
|
510
|
-
*
|
|
511
|
+
* This function cannot fail. If the given signal doesn’t exist, a critical
|
|
512
|
+
* warning is emitted.
|
|
513
|
+
*
|
|
514
|
+
* Returns: the handler ID, of type `gulong` (always greater than 0)
|
|
511
515
|
*/
|
|
512
516
|
/* Intentionally not using G_CONNECT_DEFAULT here to avoid deprecation
|
|
513
517
|
* warnings with older GLIB_VERSION_MAX_ALLOWED */
|
|
@@ -524,7 +528,10 @@ void g_signal_chain_from_overridden_handler (gpointer instance,
|
|
|
524
528
|
*
|
|
525
529
|
* The handler will be called synchronously, after the default handler of the signal.
|
|
526
530
|
*
|
|
527
|
-
*
|
|
531
|
+
* This function cannot fail. If the given signal doesn’t exist, a critical
|
|
532
|
+
* warning is emitted.
|
|
533
|
+
*
|
|
534
|
+
* Returns: the handler ID, of type `gulong` (always greater than 0)
|
|
528
535
|
*/
|
|
529
536
|
#define g_signal_connect_after(instance, detailed_signal, c_handler, data) \
|
|
530
537
|
g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_AFTER)
|
|
@@ -562,7 +569,10 @@ void g_signal_chain_from_overridden_handler (gpointer instance,
|
|
|
562
569
|
* (GCallback) button_clicked_cb, other_widget);
|
|
563
570
|
* ]|
|
|
564
571
|
*
|
|
565
|
-
*
|
|
572
|
+
* This function cannot fail. If the given signal doesn’t exist, a critical
|
|
573
|
+
* warning is emitted.
|
|
574
|
+
*
|
|
575
|
+
* Returns: the handler ID, of type `gulong` (always greater than 0)
|
|
566
576
|
*/
|
|
567
577
|
#define g_signal_connect_swapped(instance, detailed_signal, c_handler, data) \
|
|
568
578
|
g_signal_connect_data ((instance), (detailed_signal), (c_handler), (data), NULL, G_CONNECT_SWAPPED)
|
|
@@ -18,17 +18,25 @@
|
|
|
18
18
|
|
|
19
19
|
// Memory allocator with support for alignment and offsets.
|
|
20
20
|
|
|
21
|
+
#include <algorithm>
|
|
22
|
+
#include <array>
|
|
23
|
+
#include <cassert>
|
|
24
|
+
#include <cstring>
|
|
25
|
+
#include <initializer_list>
|
|
21
26
|
#include <memory>
|
|
27
|
+
#include <type_traits>
|
|
22
28
|
#include <utility>
|
|
23
29
|
|
|
24
30
|
#include "hwy/base.h"
|
|
31
|
+
#include "hwy/per_target.h"
|
|
25
32
|
|
|
26
33
|
namespace hwy {
|
|
27
34
|
|
|
28
35
|
// Minimum alignment of allocated memory for use in HWY_ASSUME_ALIGNED, which
|
|
29
|
-
// requires a literal.
|
|
30
|
-
//
|
|
31
|
-
|
|
36
|
+
// requires a literal. To prevent false sharing, this should be at least the
|
|
37
|
+
// L1 cache line size, usually 64 bytes. However, Intel's L2 prefetchers may
|
|
38
|
+
// access pairs of lines, and POWER8 also has 128.
|
|
39
|
+
#define HWY_ALIGNMENT 128
|
|
32
40
|
|
|
33
41
|
// Pointers to functions equivalent to malloc/free with an opaque void* passed
|
|
34
42
|
// to them.
|
|
@@ -40,7 +48,8 @@ using FreePtr = void (*)(void* opaque, void* memory);
|
|
|
40
48
|
// the vector size. Calls `alloc` with the passed `opaque` pointer to obtain
|
|
41
49
|
// memory or malloc() if it is null.
|
|
42
50
|
HWY_DLLEXPORT void* AllocateAlignedBytes(size_t payload_size,
|
|
43
|
-
AllocPtr alloc_ptr
|
|
51
|
+
AllocPtr alloc_ptr = nullptr,
|
|
52
|
+
void* opaque_ptr = nullptr);
|
|
44
53
|
|
|
45
54
|
// Frees all memory. No effect if `aligned_pointer` == nullptr, otherwise it
|
|
46
55
|
// must have been returned from a previous call to `AllocateAlignedBytes`.
|
|
@@ -110,8 +119,7 @@ AlignedUniquePtr<T> MakeUniqueAlignedWithAlloc(AllocPtr alloc, FreePtr free,
|
|
|
110
119
|
// functions.
|
|
111
120
|
template <typename T, typename... Args>
|
|
112
121
|
AlignedUniquePtr<T> MakeUniqueAligned(Args&&... args) {
|
|
113
|
-
T* ptr = static_cast<T*>(AllocateAlignedBytes(
|
|
114
|
-
sizeof(T), /*alloc_ptr=*/nullptr, /*opaque_ptr=*/nullptr));
|
|
122
|
+
T* ptr = static_cast<T*>(AllocateAlignedBytes(sizeof(T)));
|
|
115
123
|
return AlignedUniquePtr<T>(new (ptr) T(std::forward<Args>(args)...),
|
|
116
124
|
AlignedDeleter());
|
|
117
125
|
}
|
|
@@ -207,5 +215,162 @@ AlignedFreeUniquePtr<T[]> AllocateAligned(const size_t items) {
|
|
|
207
215
|
return AllocateAligned<T>(items, nullptr, nullptr, nullptr);
|
|
208
216
|
}
|
|
209
217
|
|
|
218
|
+
// A simple span containing data and size of data.
|
|
219
|
+
template <typename T>
|
|
220
|
+
class Span {
|
|
221
|
+
public:
|
|
222
|
+
Span() = default;
|
|
223
|
+
Span(T* data, size_t size) : size_(size), data_(data) {}
|
|
224
|
+
template <typename U>
|
|
225
|
+
Span(U u) : Span(u.data(), u.size()) {}
|
|
226
|
+
Span(std::initializer_list<const T> v) : Span(v.begin(), v.size()) {}
|
|
227
|
+
|
|
228
|
+
// Copies the contents of the initializer list to the span.
|
|
229
|
+
Span<T>& operator=(std::initializer_list<const T> v) {
|
|
230
|
+
HWY_DASSERT(size_ == v.size());
|
|
231
|
+
CopyBytes(v.begin(), data_, sizeof(T) * std::min(size_, v.size()));
|
|
232
|
+
return *this;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Returns the size of the contained data.
|
|
236
|
+
size_t size() const { return size_; }
|
|
237
|
+
|
|
238
|
+
// Returns a pointer to the contained data.
|
|
239
|
+
T* data() { return data_; }
|
|
240
|
+
T* data() const { return data_; }
|
|
241
|
+
|
|
242
|
+
// Returns the element at index.
|
|
243
|
+
T& operator[](size_t index) const { return data_[index]; }
|
|
244
|
+
|
|
245
|
+
// Returns an iterator pointing to the first element of this span.
|
|
246
|
+
T* begin() { return data_; }
|
|
247
|
+
|
|
248
|
+
// Returns a const iterator pointing to the first element of this span.
|
|
249
|
+
constexpr const T* cbegin() const { return data_; }
|
|
250
|
+
|
|
251
|
+
// Returns an iterator pointing just beyond the last element at the
|
|
252
|
+
// end of this span.
|
|
253
|
+
T* end() { return data_ + size_; }
|
|
254
|
+
|
|
255
|
+
// Returns a const iterator pointing just beyond the last element at the
|
|
256
|
+
// end of this span.
|
|
257
|
+
constexpr const T* cend() const { return data_ + size_; }
|
|
258
|
+
|
|
259
|
+
private:
|
|
260
|
+
size_t size_ = 0;
|
|
261
|
+
T* data_ = nullptr;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// A multi dimensional array containing an aligned buffer.
|
|
265
|
+
//
|
|
266
|
+
// To maintain alignment, the innermost dimension will be padded to ensure all
|
|
267
|
+
// innermost arrays are aligned.
|
|
268
|
+
template <typename T, size_t axes>
|
|
269
|
+
class AlignedNDArray {
|
|
270
|
+
static_assert(std::is_trivial<T>::value,
|
|
271
|
+
"AlignedNDArray can only contain trivial types");
|
|
272
|
+
|
|
273
|
+
public:
|
|
274
|
+
AlignedNDArray(AlignedNDArray&& other) = default;
|
|
275
|
+
AlignedNDArray& operator=(AlignedNDArray&& other) = default;
|
|
276
|
+
|
|
277
|
+
// Constructs an array of the provided shape and fills it with zeros.
|
|
278
|
+
explicit AlignedNDArray(std::array<size_t, axes> shape) : shape_(shape) {
|
|
279
|
+
sizes_ = ComputeSizes(shape_);
|
|
280
|
+
memory_shape_ = shape_;
|
|
281
|
+
// Round the innermost dimension up to the number of bytes available for
|
|
282
|
+
// SIMD operations on this architecture to make sure that each innermost
|
|
283
|
+
// array is aligned from the first element.
|
|
284
|
+
memory_shape_[axes - 1] = RoundUpTo(memory_shape_[axes - 1], VectorBytes());
|
|
285
|
+
memory_sizes_ = ComputeSizes(memory_shape_);
|
|
286
|
+
buffer_ = hwy::AllocateAligned<T>(memory_size());
|
|
287
|
+
hwy::ZeroBytes(buffer_.get(), memory_size() * sizeof(T));
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Returns a span containing the innermost array at the provided indices.
|
|
291
|
+
Span<T> operator[](std::array<const size_t, axes - 1> indices) {
|
|
292
|
+
return Span<T>(buffer_.get() + Offset(indices), sizes_[indices.size()]);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Returns a const span containing the innermost array at the provided
|
|
296
|
+
// indices.
|
|
297
|
+
Span<const T> operator[](std::array<const size_t, axes - 1> indices) const {
|
|
298
|
+
return Span<const T>(buffer_.get() + Offset(indices),
|
|
299
|
+
sizes_[indices.size()]);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
// Returns the shape of the array, which might be smaller than the allocated
|
|
303
|
+
// buffer after padding the last axis to alignment.
|
|
304
|
+
const std::array<size_t, axes>& shape() const { return shape_; }
|
|
305
|
+
|
|
306
|
+
// Returns the shape of the allocated buffer, which might be larger than the
|
|
307
|
+
// used size of the array after padding to alignment.
|
|
308
|
+
const std::array<size_t, axes>& memory_shape() const { return memory_shape_; }
|
|
309
|
+
|
|
310
|
+
// Returns the size of the array, which might be smaller than the allocated
|
|
311
|
+
// buffer after padding the last axis to alignment.
|
|
312
|
+
size_t size() const { return sizes_[0]; }
|
|
313
|
+
|
|
314
|
+
// Returns the size of the allocated buffer, which might be larger than the
|
|
315
|
+
// used size of the array after padding to alignment.
|
|
316
|
+
size_t memory_size() const { return memory_sizes_[0]; }
|
|
317
|
+
|
|
318
|
+
// Returns a pointer to the allocated buffer.
|
|
319
|
+
T* data() { return buffer_.get(); }
|
|
320
|
+
|
|
321
|
+
// Returns a const pointer to the buffer.
|
|
322
|
+
const T* data() const { return buffer_.get(); }
|
|
323
|
+
|
|
324
|
+
// Truncates the array by updating its shape.
|
|
325
|
+
//
|
|
326
|
+
// The new shape must be equal to or less than the old shape in all axes.
|
|
327
|
+
//
|
|
328
|
+
// Doesn't modify underlying memory.
|
|
329
|
+
void truncate(const std::array<size_t, axes>& new_shape) {
|
|
330
|
+
#if HWY_IS_DEBUG_BUILD
|
|
331
|
+
for (size_t axis_index = 0; axis_index < axes; ++axis_index) {
|
|
332
|
+
HWY_ASSERT(new_shape[axis_index] <= shape_[axis_index]);
|
|
333
|
+
}
|
|
334
|
+
#endif
|
|
335
|
+
shape_ = new_shape;
|
|
336
|
+
sizes_ = ComputeSizes(shape_);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
private:
|
|
340
|
+
std::array<size_t, axes> shape_;
|
|
341
|
+
std::array<size_t, axes> memory_shape_;
|
|
342
|
+
std::array<size_t, axes + 1> sizes_;
|
|
343
|
+
std::array<size_t, axes + 1> memory_sizes_;
|
|
344
|
+
hwy::AlignedFreeUniquePtr<T[]> buffer_;
|
|
345
|
+
|
|
346
|
+
// Computes offset in the buffer based on the provided indices.
|
|
347
|
+
size_t Offset(std::array<const size_t, axes - 1> indices) const {
|
|
348
|
+
size_t offset = 0;
|
|
349
|
+
size_t shape_index = 0;
|
|
350
|
+
for (const size_t axis_index : indices) {
|
|
351
|
+
offset += memory_sizes_[shape_index + 1] * axis_index;
|
|
352
|
+
shape_index++;
|
|
353
|
+
}
|
|
354
|
+
return offset;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Computes the sizes of all sub arrays based on the sizes of each axis.
|
|
358
|
+
//
|
|
359
|
+
// Does this by multiplying the size of each axis with the previous one in
|
|
360
|
+
// reverse order, starting with the conceptual axis of size 1 containing the
|
|
361
|
+
// actual elements in the array.
|
|
362
|
+
static std::array<size_t, axes + 1> ComputeSizes(
|
|
363
|
+
std::array<size_t, axes> shape) {
|
|
364
|
+
std::array<size_t, axes + 1> sizes;
|
|
365
|
+
size_t axis = shape.size();
|
|
366
|
+
sizes[axis] = 1;
|
|
367
|
+
while (axis > 0) {
|
|
368
|
+
--axis;
|
|
369
|
+
sizes[axis] = sizes[axis + 1] * shape[axis];
|
|
370
|
+
}
|
|
371
|
+
return sizes;
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
|
|
210
375
|
} // namespace hwy
|
|
211
376
|
#endif // HIGHWAY_HWY_ALIGNED_ALLOCATOR_H_
|