class BOAST::Operator

Constants

DISCARD_OPTIONS

Public Class Methods

convert(arg, type) click to toggle source
# File lib/BOAST/Language/Operators.rb, line 16
def Operator.convert(arg, type)
  return "#{arg}" if get_vector_name(arg.type) == get_vector_name(type) or lang == CUDA

  if arg.type.vector_length == 1 and type.vector_length > 1 then
    return "#{Set::new( arg, Variable::new(:dummy, type.class, type.to_hash) )}"
  end

  return "convert_#{type.decl}( #{arg} )" if lang == CL

  path = get_conversion_path(type, arg.type)
  s = "#{arg}"
  if path.length > 1 then
    path.each_cons(2) { |slice|
      instruction = intrinsics_by_vector_name(:CVT, slice[1], slice[0])
      s = "#{instruction}( #{s} )"
    }
  end
  return s
end
inspect() click to toggle source
# File lib/BOAST/Language/Operators.rb, line 12
def Operator.inspect
  return "#{name}"
end