| 248 | // string operations |
| 249 | |
| 250 | vec4f SimPolicy_String::Add ( vec4f a, vec4f b, Context & context, LineInfo * at ) { |
| 251 | const char * sA = to_rts(a); |
| 252 | auto la = stringLength(context, sA); |
| 253 | const char * sB = to_rts(b); |
| 254 | auto lb = stringLength(context, sB); |
| 255 | uint32_t commonLength = la + lb; |
| 256 | if ( !commonLength ) { |
| 257 | return v_zero(); |
| 258 | } else if ( char * sAB = (char * ) context.allocateString(nullptr, commonLength, at) ) { |
| 259 | memcpy ( sAB, sA, la ); |
| 260 | memcpy ( sAB+la, sB, lb+1 ); |
| 261 | context.stringHeap->recognize(sAB); |
| 262 | return cast<char *>::from(sAB); |
| 263 | } else { |
| 264 | context.throw_out_of_memory(true, commonLength, at); |
| 265 | return v_zero(); |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | void SimPolicy_String::SetAdd ( char * a, vec4f b, Context & context, LineInfo * at ) { |
| 270 | char ** pA = (char **)a; |
nothing calls this directly
no test coverage detected