Class: BOAST::Int
Instance Attribute Summary collapse
-
#signed ⇒ Object
readonly
Returns the value of attribute signed.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Class Method Summary collapse
Instance Method Summary collapse
- #decl ⇒ Object
-
#initialize(hash = {}) ⇒ Int
constructor
A new instance of Int.
Constructor Details
#initialize(hash = {}) ⇒ Int
Returns a new instance of Int.
1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 |
# File 'lib/BOAST/Algorithm.rb', line 1108 def initialize(hash={}) if hash[:size] then @size = hash[:size] else @size = BOAST::get_default_int_size end if hash[:signed] != nil then @signed = hash[:signed] else @signed = BOAST::get_default_int_signed end end |
Instance Attribute Details
#signed ⇒ Object (readonly)
Returns the value of attribute signed.
1107 1108 1109 |
# File 'lib/BOAST/Algorithm.rb', line 1107 def signed @signed end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
1106 1107 1108 |
# File 'lib/BOAST/Algorithm.rb', line 1106 def size @size end |
Class Method Details
Instance Method Details
#decl ⇒ Object
1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 |
# File 'lib/BOAST/Algorithm.rb', line 1120 def decl return "integer(kind=#{@size})" if BOAST::get_lang == FORTRAN return "int#{8*@size}_t" if BOAST::get_lang == C if BOAST::get_lang == CL then #char="cl_" char="" char += "u" if not @signed return char += "char" if @size==1 return char += "short" if @size==2 return char += "int" if @size==4 return char += "long" if @size==8 elsif BOAST::get_lang == CUDA then char = "" char += "unsigned " if not @signed return char += "char" if @size==1 return char += "short" if @size==2 return char += "int" if @size==4 return char += "long long" if @size==8 end end |