
    sh                         S r SSKrSSKJr  SSKJr  SSKJrJ	r	  SSK
Jr  S rS rS r " S	 S
\5      r " S S\5      r\" 5       rg)zD
Register external C functions necessary for Numba code generation.
    N)ir)utils
intrinsics)
_helperlibc                 h    [         R                  " U 5      (       d  [         R                  " X5        gg)z1Add missing symbol into LLVM internal symtab
    N)lladdress_of_symbol
add_symbol)symboladdrs     h/Users/tiagomarins/Projetos/claudeai/copy_bank/venv/lib/python3.13/site-packages/numba/core/externals.py_add_missing_symbolr      s&     ''
f# (    c                 f    SSK JnJnJn  [	        UR
                  U 5      nU" XC5      R                  $ )zf
Under Windows, look up a symbol inside the C runtime
and return the raw pointer value as an integer.
r   )cdllcastc_void_p)ctypesr   r   r   getattrmsvcrtvalue)r   r   r   r   fs        r   _get_msvcrt_symbolr      s+    
 ,+V$A"""r   c           
         U R                  5       nUR                  S5      nUR                  S5      n[        R                  " S5      n[        R                  " S5      n[        R
                  " US5      n[        R
                  " US5      n[        R
                  " US5      n[        R                  " XUU/5      n	[        R                  " X9SS9n
U
R                  u  pU
R                  5       n[        R                  " U5      nUR                  X5      nUR                  X5      nUR                  UR                  X5      U5      nUR                  UR                  X5      U5      nUR                  UR                  X5      UR                  UU5      5      nUR                  UU5      nUR                  UU5      nUR!                  UUR                  UR                  X5      UR                  UU5      5      5      nUR!                  UUR#                  UU5      5      nUR                  UU5      nUR                  UU5      nUR                  UU5      nUR!                  UUR                  UR                  UU5      UR                  X5      5      5      nUR!                  UUR#                  UU5      5      nUR!                  UUR                  UU5      5      nUR!                  UUR                  UR                  X5      UR                  UU5      5      5      nUR!                  UUR                  UU5      5      nUR!                  UUR                  UU5      5      nUR%                  UU5      nUR!                  UUR#                  UR%                  UU5      U5      5      nUR'                  U5        UR)                  U5        UR+                  5         U$ )zc
Compile the multi3() helper function used by LLVM
for 128-bit multiplication on 32-bit platforms.
multi3@      l        )name)codegencreate_librarycreate_ir_moduler   IntTypeConstantFunctionTypeFunctionargsappend_basic_block	IRBuildertruncashrmuland_lshraddshlzextretadd_ir_modulefinalize)contextr    libraryir_modi64i128
lower_mask_32_64fn_typefnabbbbuilderalblahbhrltrhrs                          r   compile_multi3rK      s   
 ooG$$X.G%%h/F
**R.C::c?DS*-J
++c2
C
++dB
Cood4L1G	V8	4B77DA				 Bll2G 
q	B	q	B	w||A+S	1B	w||A+S	1B 
W\\"17<<J3O	PBRA	b*	%BAw{{7<<#8#*<<J#?A 	BA 
RQ,	-B	a	BRA	b*	%BAw{{7<<C#8#*<<#?A 	BA 
RQ,	-B	Ra-	.B	RW\\"%:%,\\"c%:< 
=B 
RR,	-B	RR,	-B 	RAAw{{7<<D#93?@AKKN&!Nr   c                       \ rS rSrSrS rSrg)
_Installerh   Fc                 X    U R                   (       d  U R                  U5        SU l         gg)z
Install the functions into LLVM.  This only needs to be done once,
as the mappings are persistent during the process lifetime.
TN)
_installed_do_install)selfr5   s     r   install_Installer.installl   s%    
 W%"DO r   )rP   N)__name__
__module____qualname____firstlineno__rP   rS   __static_attributes__ r   r   rM   rM   h   s    J#r   rM   c                       \ rS rSrSrS rSrg)_ExternalMathFunctionsv   zX
Map the math functions from the C runtime library into the LLVM
execution environment.
c                 P   [         R                  S:H  n[        R                  n[        R
                  R                  S5      (       a  U(       a  [        S5      n[        SU5        OI[        R
                  R                  S5      (       a%  U(       a  [        SUS   5        [        SUS	   5        U(       a@  [        U5      U l
        U R                  R                  S
5      nU(       d   e[        SU5        [        R                   H  n[        R                  " XcU   5        M     g )Nr   win32_ftol_ftol2linux__fixunsdfdifptoui__fixunssfdifptouifr   __multi3)r   MACHINE_BITSr   	c_helperssysplatform
startswithr   r   rK   _multi3_libget_pointer_to_functionr   	INTR_MATHr   r
   )rR   r5   is32bitri   ftolptrfnames          r   rQ   "_ExternalMathFunctions._do_install|   s    $$*((	<<""7++ &g.D$/\\$$W--'	(0CD	)0DE-g6D""::8DCJ3
C0  ))E
 MM%5!12 *r   )rm   N)rU   rV   rW   rX   __doc__rQ   rY   rZ   r   r   r\   r\   v   s    
3r   r\   )ru   rj   llvmliter   llvmlite.bindingbindingr   
numba.corer   r   numbar   r   r   rK   objectrM   r\   c_math_functionsrZ   r   r   <module>r}      sP       ( $#FR# #"3Z "3J *+ r   