@@ -736,33 +736,65 @@ extension JSON {
736736 #endif
737737
738738 #if os(Windows)
739- @inline ( __always)
740- private static func calculateMaxDepth( ) -> size_t {
741- var low : ULONG_PTR = 0
742- var high : ULONG_PTR = 0
743- GetCurrentThreadStackLimits ( & low, & high)
744-
745- let stackBytes = size_t ( high &- low)
746- return min ( 1024 , max ( 16 , stackBytes / 512 ) )
747- }
748-
739+ #if compiler(>=6.3)
740+ @inline ( always)
741+ private static func calculateMaxDepth( ) -> size_t {
742+ var low : ULONG_PTR = 0
743+ var high : ULONG_PTR = 0
744+ GetCurrentThreadStackLimits ( & low, & high)
745+
746+ let stackBytes = size_t ( high &- low)
747+ return min ( 1024 , max ( 16 , stackBytes / 512 ) )
748+ }
749+ #else
750+ @inline ( __always)
751+ private static func calculateMaxDepth( ) -> size_t {
752+ var low : ULONG_PTR = 0
753+ var high : ULONG_PTR = 0
754+ GetCurrentThreadStackLimits ( & low, & high)
755+
756+ let stackBytes = size_t ( high &- low)
757+ return min ( 1024 , max ( 16 , stackBytes / 512 ) )
758+ }
759+ #endif
749760 #elseif os(WASI) || arch(wasm32)
750- @inline ( __always)
751- private static func calculateMaxDepth( ) -> size_t {
752- // There is no way to do this on Web Assembly. Makes sense.
753- 256
754- }
761+ #if compiler(>=6.3)
762+ @inline ( always)
763+ private static func calculateMaxDepth( ) -> size_t {
764+ // There is no way to do this on Web Assembly. Makes sense.
765+ 256
766+ }
767+ #else
768+ @inline ( __always)
769+ private static func calculateMaxDepth( ) -> size_t {
770+ // There is no way to do this on Web Assembly. Makes sense.
771+ 256
772+ }
773+ #endif
755774 #else
756- @inline ( __always)
757- private static func calculateMaxDepth( ) -> size_t {
758- var attr = pthread_attr_t ( )
759- pthread_attr_init ( & attr)
760- defer { pthread_attr_destroy ( & attr) }
761-
762- var size : size_t = 0
763- pthread_attr_getstacksize ( & attr, & size)
764- return min ( 1024 , max ( 16 , size / 512 ) )
765- }
775+ #if compiler(>=6.3)
776+ @inline ( always)
777+ private static func calculateMaxDepth( ) -> size_t {
778+ var attr = pthread_attr_t ( )
779+ pthread_attr_init ( & attr)
780+ defer { pthread_attr_destroy ( & attr) }
781+
782+ var size : size_t = 0
783+ pthread_attr_getstacksize ( & attr, & size)
784+ return min ( 1024 , max ( 16 , size / 512 ) )
785+ }
786+ #else
787+ @inline ( __always)
788+ private static func calculateMaxDepth( ) -> size_t {
789+ var attr = pthread_attr_t ( )
790+ pthread_attr_init ( & attr)
791+ defer { pthread_attr_destroy ( & attr) }
792+
793+ var size : size_t = 0
794+ pthread_attr_getstacksize ( & attr, & size)
795+ return min ( 1024 , max ( 16 , size / 512 ) )
796+ }
797+ #endif
766798 #endif
767799
768800 private static func calculateMaxInputSize( ) -> size_t {
0 commit comments