parameters: (context, builder, sig, args)
return_statement: return impl_ret_new_ref(context, builder, sig.return_type, res)
docstring: numba.numpy_support.carray(...) and
      numba.numpy_support.farray(...).
docstring_summary: numba.numpy_support.carray(...) and
      numba.numpy_support.farray(...).
docstring_tokens: numba . numpy_support . carray ( ... ) and numba . numpy_support . farray ( ... ) .
function: def np_cfarray(context, builder, sig, args):
      """
      numba.numpy_support.carray(...) and
      numba.numpy_support.farray(...).
      """
      ptrty, shapety = sig.args[:2]
      ptr, shape = args[:2]
  
      aryty = sig.return_type
      assert aryty.layout in 'CF'
  
      out_ary = make_array(aryty)(context, builder)
  
      itemsize = get_itemsize(context, aryty)
      ll_itemsize = cgutils.intp_t(itemsize)
  
      if isinstance(shapety, types.BaseTuple):
          shapes = cgutils.unpack_tuple(builder, shape)
      else:
          shapety = (shapety,)
          shapes = (shape,)
      shapes = [context.cast(builder, value, fromty, types.intp)
                for fromty, value in zip(shapety, shapes)]
  
      off = ll_itemsize
      strides = []
      if aryty.layout == 'F':
          for s in shapes:
              strides.append(off)
              off = builder.mul(off, s)
      else:
          for s in reversed(shapes):
              strides.append(off)
              off = builder.mul(off, s)
          strides.reverse()
  
      data = builder.bitcast(ptr,
                             context.get_data_type(aryty.dtype).as_pointer())
  
      populate_array(out_ary,
                     data=data,
                     shape=shapes,
                     strides=strides,
                     itemsize=ll_itemsize,
                     # Array is not memory-managed
                     meminfo=None,
                     )
  
      res = out_ary._getvalue()
      return impl_ret_new_ref(context, builder, sig.return_type, res)
function_tokens: def np_cfarray ( context , builder , sig , args ) : ptrty , shapety = sig . args [ : 2 ] ptr , shape = args [ : 2 ] aryty = sig . return_type assert aryty . layout in 'CF' out_ary = make_array ( aryty ) ( context , builder ) itemsize = get_itemsize ( context , aryty ) ll_itemsize = cgutils . intp_t ( itemsize ) if isinstance ( shapety , types . BaseTuple ) : shapes = cgutils . unpack_tuple ( builder , shape ) else : shapety = ( shapety , ) shapes = ( shape , ) shapes = [ context . cast ( builder , value , fromty , types . intp ) for fromty , value in zip ( shapety , shapes ) ] off = ll_itemsize strides = [ ] if aryty . layout == 'F' : for s in shapes : strides . append ( off ) off = builder . mul ( off , s ) else : for s in reversed ( shapes ) : strides . append ( off ) off = builder . mul ( off , s ) strides . reverse ( ) data = builder . bitcast ( ptr , context . get_data_type ( aryty . dtype ) . as_pointer ( ) ) populate_array ( out_ary , data = data , shape = shapes , strides = strides , itemsize = ll_itemsize , # Array is not memory-managed meminfo = None , ) res = out_ary . _getvalue ( ) return impl_ret_new_ref ( context , builder , sig . return_type , res )