B
     \                 @   sT   d Z ddlmZ ddlmZ ddlmZmZ edd Zedd Z	ed	d
 Z
dS )z
This file provides internal compiler utilities that support certain special
operations with bytes and workarounds for limitations enforced in userland.
    )	intrinsic)ir)typescgutilsc             C   s    dd }t t jt j}||fS )Nc             S   s6   |\}}| |td }||||g}|S )N   )bitcastr   IntType
as_pointerloadgep)contextbuilder	signatureargsdataidxptrch r   1lib/python3.7/site-packages/numba/unsafe/bytes.pyimpl   s    zgrab_byte.<locals>.impl)r   Zuint8voidptrintp)	typingctxr   offsetr   sigr   r   r   	grab_byte   s    r   c             C   s    dd }t t jt j}||fS )Nc             S   s6   |\}}| |td }||||g}|S )N@   )r   r   r   r	   r
   r   )r   r   r   r   r   r   r   r   r   r   r   r      s    zgrab_uint64_t.<locals>.impl)r   Zuint64r   r   )r   r   r   r   r   r   r   r   grab_uint64_t   s    r   c       	      C   s0   dd }t t jt jt jt jt jt j}||fS )z;Copy nbytes from *(src + src_offset) to *(dst + dst_offset)c             S   sF   |\}}}}}}	| ||g}
| ||g}t|||
||	 |  S )N)r   r   Z
raw_memcpyZget_dummy_value)r   r   r   r   Zdst_valZdst_offset_valZsrc_valZsrc_offset_valZ
nbytes_valZ	align_valZsrc_ptrZdst_ptrr   r   r   codegen'   s
    zmemcpy_region.<locals>.codegen)r   Zvoidr   r   )	r   dstZ
dst_offsetsrcZ
src_offsetnbytesZalignr   r   r   r   r   memcpy_region$   s     r#   N)__doc__Znumba.extendingr   Zllvmliter   Znumbar   r   r   r   r#   r   r   r   r   <module>   s   