You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2023/01/07 08:15:49 UTC

[GitHub] [incubator-kvrocks] PragmaTwice opened a new pull request, #1218: Add integer parsing with unit support

PragmaTwice opened a new pull request, #1218:
URL: https://github.com/apache/incubator-kvrocks/pull/1218

   Add `ParseSizeAndUnit`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] tisonkun commented on pull request #1218: Add integer parsing with unit support

Posted by GitBox <gi...@apache.org>.
tisonkun commented on PR #1218:
URL: https://github.com/apache/incubator-kvrocks/pull/1218#issuecomment-1374500356

   @PragmaTwice Could you please link the motivation of adding such a feature?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] PragmaTwice commented on pull request #1218: Add integer parsing with unit support

Posted by GitBox <gi...@apache.org>.
PragmaTwice commented on PR #1218:
URL: https://github.com/apache/incubator-kvrocks/pull/1218#issuecomment-1374503231

   > @PragmaTwice Could you please link the motivation of adding such a feature?
   
   It is needed in #953, and the implementation in #953 is poor enough so I do not want to refactor these code after merge it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] torwig commented on a diff in pull request #1218: Add integer parsing with unit support

Posted by GitBox <gi...@apache.org>.
torwig commented on code in PR #1218:
URL: https://github.com/apache/incubator-kvrocks/pull/1218#discussion_r1063986175


##########
src/common/parse_util.cc:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "parse_util.h"
+
+#include <limits>
+
+// num << bit <= MAX  ->  num <= MAX >> bit
+template <typename T, typename U>
+StatusOr<T> CheckedShl(T num, U bit) {

Review Comment:
   Is it better to name it as `CheckedShiftL` (to describe the main operation which is a **shift** and stress on the letter `L`) or even `CheckedShiftLeft`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] PragmaTwice commented on a diff in pull request #1218: Add integer parsing with unit support

Posted by GitBox <gi...@apache.org>.
PragmaTwice commented on code in PR #1218:
URL: https://github.com/apache/incubator-kvrocks/pull/1218#discussion_r1064003072


##########
src/common/parse_util.cc:
##########
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+#include "parse_util.h"
+
+#include <limits>
+
+// num << bit <= MAX  ->  num <= MAX >> bit
+template <typename T, typename U>
+StatusOr<T> CheckedShl(T num, U bit) {

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-kvrocks] tisonkun merged pull request #1218: Add integer parsing with unit support

Posted by GitBox <gi...@apache.org>.
tisonkun merged PR #1218:
URL: https://github.com/apache/incubator-kvrocks/pull/1218


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org