o
    Td                     @   sT   d Z ddlmZmZ ddlmZ ddlmZ edd Zedd Z	ed	d
 Z
dS )z? This module provides the unsafe things for targets/numbers.py
    )typeserrors)	intrinsic)irc                    st   |j }t|jtjrt| nt|jtjr$|dkrt nt	  nJ d fdd}|j}|||}||fS )z4 Bitcast a scalar 'val' to the given type 'viewty'.     r   unreachablec                    s   |d }| | S )Nr   )bitcast)cgctxbuildertypargsflt	bitcastty o/home/ncw/WWW/www-new/content/articles/pi-bbp/venv/lib/python3.10/site-packages/numba/cpython/unsafe/numbers.pycodegen   s   zviewer.<locals>.codegen)
bitwidth
isinstancedtyper   Integerr   IntTypeFloat	FloatType
DoubleType)tyctxvalviewtybitsr   rettysigr   r   r   viewer	   s   
r!   c                 C   6   t |tjsd| d}t|dd }|||fS )zACounts trailing zeros in the binary representation of an integer.zCtrailing_zeros is only defined for integers, but value passed was ''.c                 S       |\}| |ttddS N   r   )cttzr   Constantr   contextr
   	signaturer   srcr   r   r   r   $      ztrailing_zeros.<locals>.codegenr   r   r   r   NumbaTypeError
typeingctxr,   msgr   r   r   r   trailing_zeros      
r3   c                 C   r"   )z@Counts leading zeros in the binary representation of an integer.zBleading_zeros is only defined for integers, but value passed was 'r#   c                 S   r$   r%   )ctlzr   r(   r   r)   r   r   r   r   2   r-   zleading_zeros.<locals>.codegenr.   r0   r   r   r   leading_zeros*   r4   r6   N)__doc__
numba.corer   r   numba.core.extendingr   llvmliter   r!   r3   r6   r   r   r   r   <module>   s    

