I am creating a vector / matrix library. (GCC, ARM NEON, iPhone)
typedef struct{ float v[4]; } Vector; typedef struct{ Vector v[4]; } Matrix;
I passed the structure data as a pointer to avoid performance degradation when copying data when calling a function. Therefore, I first developed such a function:
void makeTranslation(const Vector* factor, Matrix* restrict result);
But, if the function is built-in, is there any reason to pass values as a pointer to performance? Are these variables copied? What about register and caches? I tried to change the function as follows:
inline Matrix makeTranslation(const Vector factor) __attribute__ ((always_inline));
What do you think about the allocation of costs for each case?
, , . , . ( , ..... .) , "" , ( / , , / .)
always_inline, , ( ). , , , , , , . , , -, , , , .
always_inline
- . , , .
, . ( ) , , , , L1. (, iPhone), .
Source: https://habr.com/ru/post/1743626/More articles:Localize .NET assembly without source code - .netWhat is the difference between gtk_box_pack_start and gtk_container_add? - cHow are files (especially audio files) organized internally? - cCombining SQLite connections with Fluent NHibernate - databaseResponse to settings updates in Android - androidJumping in arv? - cCan I use the Boost format library to replace iostream? - c ++How can I open a contract with a non-SOAP web interface? - soapIs developing iPhone apps in any language other than Objective-C ever a viable solution? - objective-cHow to embed weblogic server in java? - javaAll Articles