]> sigrok.org Git - libsigrok.git/commitdiff
hantek-4032l: Use MIN() where possible.
authorUwe Hermann <redacted>
Tue, 5 Jun 2018 21:55:23 +0000 (23:55 +0200)
committerUwe Hermann <redacted>
Tue, 5 Jun 2018 21:55:23 +0000 (23:55 +0200)
src/hardware/hantek-4032l/protocol.c

index 9bebd61aebf877e2b276bca3b786124186038ad7..a3b4185888668bd6da4ad0a189a12d1e9343e3f8 100644 (file)
@@ -187,8 +187,7 @@ void LIBUSB_CALL h4032l_data_transfer_callback(struct libusb_transfer *transfer)
 
        buffer = (uint32_t *)transfer->buffer;
 
-       number_samples = (devc->remaining_samples < max_samples) ?
-                         devc->remaining_samples : max_samples;
+       number_samples = MIN(devc->remaining_samples, max_samples);
        devc->remaining_samples -= number_samples;
        send_data(sdi, buffer, number_samples);
        sr_dbg("Remaining: %d %08X %08X.", devc->remaining_samples,
@@ -289,8 +288,7 @@ void LIBUSB_CALL h4032l_usb_callback(struct libusb_transfer *transfer)
                buffer++;
                /* Fallthrough. */
        case H4032L_STATUS_TRANSFER:
-               number_samples = (devc->remaining_samples < max_samples) ?
-                                 devc->remaining_samples : max_samples;
+               number_samples = MIN(devc->remaining_samples, max_samples);
                devc->remaining_samples -= number_samples;
                send_data(sdi, buffer, number_samples);
                sr_dbg("Remaining: %d %08X %08X.", devc->remaining_samples,