@@ -3357,6 +3357,9 @@ BIF_RETTYPE string_list_to_integer_1(BIF_ALIST_1)
33573357 case LTI_NO_INTEGER :
33583358 hp = HAlloc (BIF_P ,3 );
33593359 BIF_RET (TUPLE2 (hp , am_error , am_no_integer ));
3360+ case LTI_SYSTEM_LIMIT :
3361+ hp = HAlloc (BIF_P ,3 );
3362+ BIF_RET (TUPLE2 (hp , am_error , am_system_limit ));
33603363 default :
33613364 hp = HAlloc (BIF_P ,3 );
33623365 BIF_RET (TUPLE2 (hp , res , tail ));
@@ -3365,25 +3368,27 @@ BIF_RETTYPE string_list_to_integer_1(BIF_ALIST_1)
33653368
33663369BIF_RETTYPE list_to_integer_1 (BIF_ALIST_1 )
33673370 {
3368- /* Using erts_list_to_integer is about twice as fast as using
3369- erts_chars_to_integer because we do not have to copy the
3370- entire list */
3371+ /* Using erts_list_to_integer() is about twice as fast as using
3372+ * erts_chars_to_integer() because we do not have to copy the
3373+ * entire list. */
33713374 Eterm res ;
33723375 Eterm dummy ;
33733376 /* must be a list */
3374- if (erts_list_to_integer (BIF_P , BIF_ARG_1 , 10 ,
3375- & res , & dummy ) != LTI_ALL_INTEGER ) {
3376- BIF_ERROR (BIF_P ,BADARG );
3377+ switch (erts_list_to_integer (BIF_P , BIF_ARG_1 , 10 , & res , & dummy )) {
3378+ case LTI_ALL_INTEGER :
3379+ BIF_RET (res );
3380+ case LTI_SYSTEM_LIMIT :
3381+ BIF_ERROR (BIF_P , SYSTEM_LIMIT );
3382+ default :
3383+ BIF_ERROR (BIF_P , BADARG );
33773384 }
3378- BIF_RET (res );
33793385 }
33803386
33813387BIF_RETTYPE list_to_integer_2 (BIF_ALIST_2 )
33823388{
3383- /* Bif implementation is about 50% faster than pure erlang,
3384- and since we have erts_chars_to_integer now it is simpler
3385- as well. This could be optimized further if we did not have to
3386- copy the list to buf. */
3389+ /* The BIF implementation is about 50% faster than pure Erlang,
3390+ * and since we now have erts_list_to_integer() it is simpler as
3391+ * well. */
33873392 Sint i ;
33883393 Eterm res , dummy ;
33893394 int base ;
@@ -3399,11 +3404,14 @@ BIF_RETTYPE list_to_integer_2(BIF_ALIST_2)
33993404 BIF_ERROR (BIF_P , BADARG );
34003405 }
34013406
3402- if (erts_list_to_integer (BIF_P , BIF_ARG_1 , base ,
3403- & res , & dummy ) != LTI_ALL_INTEGER ) {
3404- BIF_ERROR (BIF_P ,BADARG );
3407+ switch (erts_list_to_integer (BIF_P , BIF_ARG_1 , base , & res , & dummy )) {
3408+ case LTI_ALL_INTEGER :
3409+ BIF_RET (res );
3410+ case LTI_SYSTEM_LIMIT :
3411+ BIF_ERROR (BIF_P , SYSTEM_LIMIT );
3412+ default :
3413+ BIF_ERROR (BIF_P , BADARG );
34053414 }
3406- BIF_RET (res );
34073415}
34083416
34093417/**********************************************************************/
0 commit comments