@@ -633,74 +633,74 @@ fn number_of_bits[dtype: DType, //](owned value: Scalar[dtype]) -> Int:
633633# ===----------------------------------------------------------------------=== #
634634
635635
636- # Module-level cache for powers of 10
637- var _power_of_10_as_uint128_cache = List[UInt128]()
638- var _power_of_10_as_uint256_cache = List[UInt256]()
639-
640-
641- # Initialize with the first value
642- @always_inline
643- fn _init_power_of_10_as_uint128_cache ():
644- if len (_power_of_10_as_uint128_cache) == 0 :
645- _power_of_10_as_uint128_cache.append(1 ) # 10^0 = 1
646-
647-
648- @always_inline
649- fn _init_power_of_10_as_uint256_cache ():
650- if len (_power_of_10_as_uint256_cache) == 0 :
651- _power_of_10_as_uint256_cache.append(1 ) # 10^0 = 1
652-
653-
654- @always_inline
655- fn power_of_10_as_uint128 (n : Int) raises -> UInt128:
656- """
657- Returns 10^n using cached values when available.
658- """
659-
660- # Check for negative exponent
661- if n < 0 :
662- raise Error(
663- " power_of_10() requires non-negative exponent, got {} " .format(n)
664- )
665-
666- # Initialize cache if needed
667- if len (_power_of_10_as_uint128_cache) == 0 :
668- _init_power_of_10_as_uint128_cache()
669-
670- # Extend cache if needed
671- while len (_power_of_10_as_uint128_cache) <= n:
672- var next_power = _power_of_10_as_uint128_cache[
673- len (_power_of_10_as_uint128_cache) - 1
674- ] * 10
675- _power_of_10_as_uint128_cache.append(next_power)
676-
677- return _power_of_10_as_uint128_cache[n]
678-
679-
680- @always_inline
681- fn power_of_10_as_uint256 (n : Int) raises -> UInt256:
682- """
683- Returns 10^n using cached values when available.
684- """
685-
686- # Check for negative exponent
687- if n < 0 :
688- raise Error(
689- " power_of_10() requires non-negative exponent, got {} " .format(n)
690- )
691-
692- # Initialize cache if needed
693- if len (_power_of_10_as_uint256_cache) == 0 :
694- _init_power_of_10_as_uint256_cache()
695-
696- # Extend cache if needed
697- while len (_power_of_10_as_uint256_cache) <= n:
698- var next_power = _power_of_10_as_uint256_cache[
699- len (_power_of_10_as_uint256_cache) - 1
700- ] * 10
701- _power_of_10_as_uint256_cache.append(next_power)
702-
703- return _power_of_10_as_uint256_cache[n]
636+ # # Module-level cache for powers of 10
637+ # var _power_of_10_as_uint128_cache = List[UInt128]()
638+ # var _power_of_10_as_uint256_cache = List[UInt256]()
639+
640+
641+ # # Initialize with the first value
642+ # @always_inline
643+ # fn _init_power_of_10_as_uint128_cache():
644+ # if len(_power_of_10_as_uint128_cache) == 0:
645+ # _power_of_10_as_uint128_cache.append(1) # 10^0 = 1
646+
647+
648+ # @always_inline
649+ # fn _init_power_of_10_as_uint256_cache():
650+ # if len(_power_of_10_as_uint256_cache) == 0:
651+ # _power_of_10_as_uint256_cache.append(1) # 10^0 = 1
652+
653+
654+ # @always_inline
655+ # fn power_of_10_as_uint128(n: Int) raises -> UInt128:
656+ # """
657+ # Returns 10^n using cached values when available.
658+ # """
659+
660+ # # Check for negative exponent
661+ # if n < 0:
662+ # raise Error(
663+ # "power_of_10() requires non-negative exponent, got {}".format(n)
664+ # )
665+
666+ # # Initialize cache if needed
667+ # if len(_power_of_10_as_uint128_cache) == 0:
668+ # _init_power_of_10_as_uint128_cache()
669+
670+ # # Extend cache if needed
671+ # while len(_power_of_10_as_uint128_cache) <= n:
672+ # var next_power = _power_of_10_as_uint128_cache[
673+ # len(_power_of_10_as_uint128_cache) - 1
674+ # ] * 10
675+ # _power_of_10_as_uint128_cache.append(next_power)
676+
677+ # return _power_of_10_as_uint128_cache[n]
678+
679+
680+ # @always_inline
681+ # fn power_of_10_as_uint256(n: Int) raises -> UInt256:
682+ # """
683+ # Returns 10^n using cached values when available.
684+ # """
685+
686+ # # Check for negative exponent
687+ # if n < 0:
688+ # raise Error(
689+ # "power_of_10() requires non-negative exponent, got {}".format(n)
690+ # )
691+
692+ # # Initialize cache if needed
693+ # if len(_power_of_10_as_uint256_cache) == 0:
694+ # _init_power_of_10_as_uint256_cache()
695+
696+ # # Extend cache if needed
697+ # while len(_power_of_10_as_uint256_cache) <= n:
698+ # var next_power = _power_of_10_as_uint256_cache[
699+ # len(_power_of_10_as_uint256_cache) - 1
700+ # ] * 10
701+ # _power_of_10_as_uint256_cache.append(next_power)
702+
703+ # return _power_of_10_as_uint256_cache[n]
704704
705705
706706@always_inline
0 commit comments