Хорошо, таким образом, на основе информации на этой странице, вот запуск на блоке проверки допустимости международного телефонного номера:
function validatePhone(phoneNumber) {
var valid = true;
var stripped = phoneNumber.replace(/[\(\)\.\-\ \+\x]/g, '');
if(phoneNumber == ""){
valid = false;
}else if (isNaN(parseInt(stripped))) {
valid = false;
}else if (stripped.length > 40) {
valid = false;
}
return valid;
}
Свободно на основе сценария от этой страницы: http://www.webcheatsheet.com/javascript/form_validation.php
If the data in question is being allocated statically, then you can use the __align__
attribute that GCC supports to specify that it should be aligned to the necessary boundary. If you are dynamically allocating these arrays, you can over-allocate by the alignment value, and then bump the returned pointer up to the alignment you need.
You can also use the posix_memalign()
function if you're on a system that supports it. Finally, note that malloc()
will always allocate memory aligned to the size of the largest built-in type, generally 8 bytes for a double. If you don't need better than that, then malloc
should suffice.
Edit: If you modify your allocation code to force that check to be true (i.e. overallocate, as suggested above), the compiler should oblige by not conditionalizing the loop code. If you needed alignment to an 8-byte boundary, as it seems, that would be something like a = (a + 7) & ~3;
.
Я получил только одну версию цикла, , используя ваш точный код с этими параметрами: gcc -march = core2 -c -O2 -fdump-tree-optimized -ftree -vectorize vec.c
Моя версия GCC - gcc версии 4.4.1 (Ubuntu 4.4.1-4ubuntu8)
.
GCC делает здесь кое-что умное. Он заставляет массивы a
и b
быть выровненными по 16 байт. Он не делает этого с c
, предположительно потому, что c
никогда не используется в векторизуемом цикле.