|
@@ -105,6 +105,24 @@ void * __memmove ( void *dest, const void *src, size_t len ) {
|
105
|
105
|
}
|
106
|
106
|
}
|
107
|
107
|
|
|
108
|
+
|
|
109
|
+ * Calculate length of string
|
|
110
|
+ *
|
|
111
|
+ * @v string String
|
|
112
|
+ * @ret len Length (excluding NUL)
|
|
113
|
+ */
|
|
114
|
+size_t strlen ( const char *string ) {
|
|
115
|
+ const char *discard_D;
|
|
116
|
+ size_t len_plus_one;
|
|
117
|
+
|
|
118
|
+ __asm__ __volatile__ ( "repne scasb\n\t"
|
|
119
|
+ "not %1\n\t"
|
|
120
|
+ : "=&D" ( discard_D ), "=&c" ( len_plus_one )
|
|
121
|
+ : "0" ( string ), "1" ( -1UL ), "a" ( 0 ) );
|
|
122
|
+
|
|
123
|
+ return ( len_plus_one - 1 );
|
|
124
|
+}
|
|
125
|
+
|
108
|
126
|
|
109
|
127
|
* Compare strings (up to a specified length)
|
110
|
128
|
*
|